Isabaellchen
Isabaellchen

Reputation: 98

Is there a special character to prevent ASI

When writing Javascript without semicolons, \n becomes the idiomatic statement terminator, but sometimes it is actually not, which I would like to express in my code. So is there a special character that explicitly prevents Automatic Semicolon Insertion, to alleviate this uncertainty?

Please note that I am actually in favor of using semicolons where possible, but some of the people I work with want to omit them.

Upvotes: 2

Views: 365

Answers (2)

Nina Scholz
Nina Scholz

Reputation: 386624

Yes, it exists by using the grouping operator (). No ASI happens inside of the parentheses.

return (
    // expression
);

Upvotes: 0

Kaiido
Kaiido

Reputation: 136707

Yes, ; is what you are looking for.

Upvotes: 3

Related Questions