Get the latest tech news
On JavaScript's Weirdness
Stack Auth is the open-source Auth0 alternative. We are your login and signup page, and everything that comes with that.
I posted about this on Twitter, and a bunch of you told me that this "makes sense" if you understand how for-loops & closures are defined in terms of scope in the ECMAScript standard. There's a fairly complicated algorithm called Automatic Semicolon Insertion(ASI) that tries to guess with a bunch of heuristics where they're supposed to go. Anything that has to do with== and!= Anything that has to do with type coercion Anything that has to do with this NaN is not equal to anything+0 vs. -0 Anything that has to do with floating-point precision, or otherwise stuff that's covered by IEEE 754 typeof null is"object" Anything that uses non-strict mode or var Returning primitive values from constructors Prototype pollution Array.sort converting numbers to strings...
Or read this on Hacker News