Re:A Prettier JavaScript Formatter
by imh on Tuesday January 10, 2017 @12:56PM
(#13367050)
I don't do much serious JS. What's the problem there?
[ Parent
| on HN ]
JavaScript has automatic semicolon insertion (ASI).
This will add semicolons all over your code depending on some rules, for example, if you write a return, and write the value you want to return in the next line, it adds a semicolon after the return AND after the value, effectively ignoring the value in the end.
return
myValue;
becomes return;
myValue;
It's a bit meh, because you have to remember these rules even if you use semicolons.
Re:A Prettier JavaScript Formatter
by dustinswan on Tuesday January 10, 2017 @12:59PM
(#13367091)
The first one returns an object, the second one returns undefined