DEV Community

Discussion on: Don't name your global JavaScript function 'clear'

Collapse
 
josephthecoder profile image
Joseph Stevens

I respect your opinion, but that is absolutely not the best option.
The best option is to make reserved keywords illegal to the compiler/linter.

Aka.
function clear() {...}
Would not compile, or the editor would turn the line red.
At the very least, mark it as a warning.