[英]Does automatic semi-colon insertion in JS affect for loops with the first { on a new line?
Will JS auto semi-colon insertion place a semi-colon at the end of for(...)
like I've placed in the following example or is it safe to break the bracket onto a new line with for loops? JS自动分号插入是否会在
for(...)
的末尾放置一个分号,就像我放在下面的例子中一样,或者将括号拆分到带有for循环的新行是否安全?
for(...);
{
...
}
I've found plenty of info saying what is affected, but nothing specific to my question, which leads me to believe it may not be affected, but I would like to find a concrete answer. 我发现有很多信息说明了什么是受影响的,但我的问题没有什么特别的,这让我相信它可能不会受到影响,但我想找到一个具体的答案。
Personally, I prefer not to break onto a new line with brackets like this but the question has been raised ;) 就个人而言,我宁愿不打破像这样的括号的新行,但问题已经提出;)
Such a for
loop is safe. 这样的
for
循环是安全的。 Semicolons will never be inserted in places where they would create empty statements. 分号永远不会插入到创建空语句的地方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.