DEV Community

Discussion on: When are semicolons needed in JavaScript?

Collapse
 
pandaquests profile image
Panda Quests

Actually I was going to write a blog post about it. But I was researching first in order not to forget things. There are indeed at least two cases where semicolons aren't optional. I wonder whether there are more....?

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

You know it is call ASI, right? -- this SO post

Normally, I wouldn't run into something like

return
{ 
  foo: 1
}

Although, I do get things like this from Prettier. (I didn't create it myself.)

const foo =
  'very long text'