Hacker News new | past | comments | ask | show | jobs | submit login

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

The 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/Refe...

I use tagged templates for ensuring URL paths are URI safe, like so:

    const path = esc`/my/api/v1/${possiblyURIUnsafeVariable}`

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact