That said, it's fairly easy to avoid these problems.
This doesn't feel unique to JavaScript though? It's the same with, say, PHP.