doing some JavaScript training and playing with syntax. In JavaScript, semicolons are optional. It is recommended to use them, but the specification does not seem to impose them in some cases. In particular, it is said that when there is no ambiguity, then it does not matter whether you use them or not.
I found this example (an exercise from a blog I was looking for on Google), but no explanation. I think the semicolon should not matter here, but it is. I see no ambiguity here why this should be otherwise. I tried to play with some examples, it really seems different. I can not wrap myself around: - (
var y = x + f
(a+b).toString()
and
var y = x + f;
(a+b).toString();
It would be great if some guru could shed light on this one.