简体   繁体   English

是否有一个特殊的角色来防止ASI

[英]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. 当编写没有分号的Javascript时, \\n成为惯用语句终止符,但有时它实际上不是,我想在我的代码中表达。 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. 请注意,我实际上赞成尽可能使用分号,但我工作的一些人想要省略它们。

Yes , ; 是的; is what you are looking for. 是你在找什么。

Yes, it exists by using the grouping operator () . 是的,它通过使用分组运算符()来存在。 No ASI happens inside of the parentheses. 括号内没有ASI。

return (
    // expression
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM