An example that does unexpected things without semicolons:
var a = myFunc
(someBool ? someFunc : someOtherFunc).apply(...
myFunc will be called with the value from the tertiary as the first argument.
This is a little contrived, but there care cases where you want to start a line with parenthesis, and it really sucks to try to figure out why it's not working.
You're right, other unary operators such as ++ and -- need them as well (when used in prefix position). Less common in practice but I stand corrected nonetheless.
4
u/australasia Feb 06 '11
An example that does unexpected things without semicolons:
myFunc will be called with the value from the tertiary as the first argument.
This is a little contrived, but there care cases where you want to start a line with parenthesis, and it really sucks to try to figure out why it's not working.