3

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?

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 ;)

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Adrian Payne
  • 165
  • 2
  • 12

1 Answers1

6

Such a for loop is safe. Semicolons will never be inserted in places where they would create empty statements.

ahruss
  • 2,070
  • 16
  • 21