While trying to debug some faulty piece of JavaScript, I found a line that looks like an obvious mistake in a source file:
false++;
What I don't undestand is why this statement behaves differently in all browsers.
- In Chrome, I get a ReferenceError and the whole script is not run.
- In Firefox, I get a SyntaxError and the whole script is not run.
- In Internet Explorer, I get a SyntaxError and the script runs only until the line where the error occurs.
Is it by design that different browsers are allowed to handle the same broken JavaScript in different ways?
I know what the error is and how to fix it, but shouldn't at least the error type be mandated by the spec?