3 ms·
Ouch. I always thought JS's global-variables-by-default schtick was it's worst crime, but I've never seen such terrible consequences for it up close before. N
by JonnieCache 15y ago
Ouch.
I always thought JS's global-variables-by-default schtick was it's worst crime, but I've never seen such terrible consequences for it up close before.
Note to self: before products get to forbes, do some load testing. Even if I am using node, with its magic event loop of invulnerability.
- vonkow 15y agoAs a rule, in js I declare every var at the top of the function (or globe) in one giant var statement just because of this. Still, it's easy to get lost in the moment and mess up just once. I used to think this was just the way things were but pair-programming/code-review and/or a language with better scoping rules would've prevented this from happening.
- masklinn 15y ago> Still, it's easy to get lost in the moment and mess up just once. Get a better editor, and JSHint, and "use strict"; Implicitly declared globals can be statically checked, there is no reason not to.
- chrisrhoden 15y agoNo such thing as "global-variables-by-default". > (function () { internalvariablewithnovardelcaration = "string"; })(); > internalvariablewithnovardeclaration ReferenceError: internalvariablewithnovardeclaration is not defined