3 ms·
I also thought this looked crazy the first time I saw it. I feel like ES6+ has jumped the shark in a bunch of ways. Adding new language features can be nice, a
by burlesona 8y ago
I also thought this looked crazy the first time I saw it.
I feel like ES6+ has jumped the shark in a bunch of ways. Adding new language features can be nice, and shorthand syntax is sometimes convenient, but JS now has a bunch of inconsistent rules about what you can and can’t do syntactically.
These make for neato script tricks to impress your programmmer friends (“wait you can do THAT?!) but I think it has mostly just made the language harder to read.
But don’t worry we have build tools to fix it that will pick a single syntax for your team! /s
- phiresky 8y agoThe template strings feature is not a just "shorthand syntax", it allows you to do things that were not possible before (see [1]) [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Raw_strings https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- camelCaseOfBeer 8y agoThis is honestly my least favorite part of js and the reason I use ts. ES6 has so many syntax tricks that sometimes I delve into a new codebase and it's almost like reading a different language. Code golf is fun, I get it, but sometimes you gotta code for the next developer that'll be maintaining your shit.
- rhinoceraptor 8y agoI use tagged templates for ensuring URL paths are URI safe, like so: const path = esc`/my/api/v1/${possiblyURIUnsafeVariable}`