Why these unambiguous expressions are different in JavaScript? -


doing javascript learning , playing around syntax. in javascript semicolons optional. recommended use them, seems specification not impose them in cases. in particular said when there no ambiguity, not make difference whether use them or not.

i found example (an exercise blog googled), no explanation. think semicolon should not make difference here, does. don't see ambiguity here, why supposed different. tried play around examples, seems different. can't wrap head around :-(

var y = x + f (a+b).tostring() 

and

var y = x + f; (a+b).tostring(); 

would cool if guru shed light on one.

the f followed whitespace , ( can interpreted function call. placing semicolon prevent this.


Comments