4 ms·
Yeah, he did. As a javascript developer I wouldn't limit myself that much though - he considers using ++ a sign of bad code.
by tomjen3 13y ago
Yeah, he did. As a javascript developer I wouldn't limit myself that much though - he considers using ++ a sign of bad code.
- rallison 13y agoTo be fair, Crockford gives his reasons [1] and the replacement is literally += 1 instead of ++. Given the very low cost of the change, and that it is an optional rule in jslint, I have no problem with it. [1] See here for more discussion and links to Crockford explaining the reasons: http://stackoverflow.com/questions/971312/why-avoid-increment-and-decrement-operators-in-javascript http://stackoverflow.com/questions/971312/why-avoid-incremen...
- tomjen3 13y agoTrue, but for me the issue is that with += I have to double check that it is only adding one (and not skipping any) to understand the loop, where as ++ is something I have seen so many times that my brain reads it in a different way.