JavaScript’s Next Evolution: “use stricter”;

Photo by Markus Spiske on Unsplash

The introduction of “use strict”; greatly cleaned up the language, but there’s still some pain points to eliminate. I think JavaScript is ready for “use stricter”;!

Disclaimer: This is not a real or upcoming feature of JavaScript, just my wishlist.

  • Optional chaining and function invocation by default. ?., ?[], and ?() are no longer necessary. Still want to blow up the whole app when traversing goes awry? Use the coalescing operator: uh.oh.spaghettio ?? throw new Error(‘burn it down’);.
  • null === undefined. Then you only have to check one value. Why the hell are there two “empty” values anyway?!
  • typeof null === ‘undefined’. In keeping with the above point.
  • 0 is truthy. NaN is the only falsy number we need.
  • Nothing coerces to a number. Use parseInt and parseFloat to coerce strings.
  • + is only for addition, not string concatenation. Use template literals instead.
  • Array.prototype.indexOf returns NaN (a falsy value!) for no matches, not -1.
  • No Automatic Semicolon Insertion. Stop being lazy, developers.
  • Only strict equality is allowed. == does the same as ===.
  • parseInt radix always defaults to 10. I mean, how many times have you meant for it to be 8 or 16?

Was there anything I missed? We can always put those things in the next breaking change of JavaScript: “use strictest”; 😆

Web Developer, Oregonian, husband

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store