2 ms·
From the article, the only really nasty things are: [a].forEach(fn(){}) [b].forEach(fn(){}) // Parses as [a][b] return a+b // Parses as return; Y
by notauser 16y ago
From the article, the only really nasty things are:
[a].forEach(fn(){})
[b].forEach(fn(){})
// Parses as [a][b]
return
a+b
// Parses as return;
You would have to work pretty hard to trigger the rest.
I'm curious about the speed trade offs from removing semicolons. You shrink the source code a little, but does the parser throwing exceptions all the time bump up execution time?
- barrkel 16y agoA parser would not normally handle this kind of thing with exceptions, and any cost would only be paid once, at parse time when building a syntax tree, not at execution time. Very few languages interpret text directly, rather than interpreting trees, as the trees are far easier to work with, more efficient, etc.