4 ms·
>There really is only one ASI rule you need to remember [0] in practice: don't begin a new line with ( or [ if it's intended to be a new statement. Here's an e
by benihana 11y ago
>There really is only one ASI rule you need to remember [0] in practice: don't begin a new line with ( or [ if it's intended to be a new statement.
Here's an even easier and clearer one: finish every statement with a semicolon.
- insin 11y agoThis is precisely why I hate optional syntax, regardless of which way your preferences fall on this particular one.
- swang 11y agofunction hello() { var x = 0; return { x: x, y: y }; }; Just putting semicolons where you think it can work won't help you. If you write javascript, you must know what the asi does. So semicolons or no semicolons is completely irrelevant.
- bakabaka9 11y agoMindlessly inserting unnecessary syntax instead of learning the damn language. Hacker News should be proud of its lusers.
- taco_emoji 11y agoI don't have a photographic memory. If "learning the language" means rote memorization of an inconsistent set of rules for how the fucking code is parsed, then you're goddamn right I'd rather mindlessly insert a character that obviates that.