re: Don't name your global JavaScript function 'clear' VIEW POST


Or just don't put anything in the global scope at all 🙂 But if you must do it, just prefix your variable/function name with something unique., like so:

function GLOBAL_FN__clear() {
            document.getElementById('result').innerHTML = '';

Interesting post tho 👍


Yes, I definitely agree, and thanks for the tip. I came across this, and wanted to share as at first I was puzzled with what's happening :), and it surely can help beginners.

code of conduct - report abuse