3 ms·
The new syntax isn't syntactically valid Javascript. It's valid syntax inside a transpiler language like Babel. It doesn't have to be in quotes because the too
by kazinator 3y ago
The new syntax isn't syntactically valid Javascript. It's valid syntax inside a transpiler language like Babel.
It doesn't have to be in quotes because the tool, like Babel, has tokenization and parsing rules for it which disambiguate it somehow. It basically is a kind of quote. Or, well quasiquote. Just like " introduces a textual quote, a token sequence like <div> introduces a HTML quasiquote.
You can transform a language into JS that doesn't look like JS in any regard. So of course you can transform one that looks like JS, but does weird things that would be syntax errors in JS.