3 ms·
No idea what GP was trying to say, but the C style intuition is correct. The bug in that code is due to omitted brackets, it has nothing to do with semicolons/A
by fenomas 7y ago
No idea what GP was trying to say, but the C style intuition is correct. The bug in that code is due to omitted brackets, it has nothing to do with semicolons/ASI.
- z3t4 7y agoMy point was that its hard to tell where the semicolon will be inserted. As well as the intention of the programmer. Here is another example: if(x) return "foo" return callback (1,2,3,4)
- fenomas 7y agoI think I see what you're saying, but the context here was asking for cases where omitting semicolons causes non-obvious bugs. I mean: if(x) return "foo" clearly there's a bug there, but adding in semicolons wouldn't change the code's behavior. So it doesn't affect the "is it bad to omit semicolons?" debate either way.
- z3t4 7y agoif(y) return "bar" The linter will tell you there should be a semicolon, and you are like, - no it shouldn't.