by MatthewPhillips · 14y ago · 0 comments
> A linebreak indicates, in most cases, the end of a statement; a semicolon is automatically inserted for you.
These are weasel words. Either a line break is the end of a statement or it's not. In JavaScript it is not.
> In order to be able to write properly working code, you need to be aware of the rules of Automatic Semicolon Insertion, regardless if you choose to add semicolons at the end of lines or not.
You absolutely do not. I don't care if you use semicolons or not, but don't claim that knowledge of ASI is required to write good JavaScript.
> Fix problems when you actually have them. Use the time you’ve freed up by not prematurely optimizing and spend it with your family or have a holiday on the beach.
Using deprecated features like __proto__ and arguments.callee is not something that you can trivially fix later. These are advanced features and I can't think of an easy why to duplicate their behavior once they are gone. You're going to have to rewrite a significant chunk of your code. Please never, ever use these features in libraries that are shared with other developers.
FTFY
No, actually, that's how it works in JS. ASI doesn't "work" in all cases because a line break doesn't always indicate the end of a statement. No less than Brendan Eich wrote this himself, in his blog post reply to the whole "semicolongate" which happened a couple weeks ago.
I'm sure it feels good to be all righteously angry… but it helps to be right.
> My two cents: be careful not to use ASI as if it gave JS significant newlines.
> Weasel word: An equivocal word used to deprive a statement of its force or to evade a direct commitment.
From the article, emphasis mine:
> A linebreak indicates, in most cases, the end of a statement;