This has been the source of my pain for many hours. Can anyone explain why this is the case?
function x(){
return //when there's a line break it doesn't work
2;
};
alert(x());
function y(){
return 4; //when there's no line break it works
};
alert(y());
//Can anyone explain this?
I always thought that JavaScript didn't care about line breaks. If you have links to ECMA official documentation on this, I'd be grateful. Thanks!