Find Related products on Amazon

Shop on Amazon

On JavaScript's Weirdness

Published on: 2025-05-13 19:11:26

“JavaScript sucks because '0' == 0 !” - literally everyone ever Sure, that part of JavaScript sucks, but every JS setup these days contains a linter that yells at you for code like that. Instead, I want to talk about some of the weirder quirks of JavaScript — those that are much more insidious than that — the kind of stuff you wouldn't find on r/ProgrammerHumor or a JS tutorial. All of them can occur in any JavaScript/ECMAScript environment (so browser, Node.js, etc.), with or without use strict enabled. (If you're working on legacy projects without strict mode, you should run. And if you don't know where to: Stack Auth is hiring.) #1. eval is worse than you think How silly it would be to think that these two are the same: function a(s) { eval("console.log(s)"); } a("hello"); // prints "hello" function b(s) { const evalButRenamed = eval; evalButRenamed("console.log(s)"); } b("hello"); // Uncaught ReferenceError: s is not defined The difference is that the former has access to va ... Read full article.