Don't create your own Map class/global in javascript
In my Domain of the Ancients javascript game I have a class (which, of course, is therefore a global variable) called Map
to represent the game map. As it turns out that's a bad idea! There's a perfectly good global object in javascript already called Map and so, of course, my definition ended up replacing that one. As it happens I don't use that object (at least not at the time of writing), but node.js does and it will break12. As my unit tests in my build process use node.js for my unit testing my unit tests broke3. Anyway, to cut the story short, I've renamed my Map class to GameMap.