\"use strict\"; seems awesome, and we\'d really like to use it at our shop. However, we just want it so that we (the developers) can find strictness-issues; we very much DO
It's the latter. While beeing in strict mode
, an Javascript interpreter may throw error messages at runtime, which would not get thrown in non-strict mode.
On the other hand, most of these errors are "good errors", which means, they will actually help not breaking your code.
For instance
function foo() {
"use strict";
bar = true;
}
foo();
This will throw
"ReferenceError: assignment to undeclared variable bar"
in strict mode, which is a good thing. In non strict mode, we would just have created a global variable called bar
, which is probably not what we wanted. There are plenty of other situations where strict mode
prevents the programmer from doing something stupid/bad/unwanted and throws error messages. But again, you want to have those errors instead of some wierd bugs.
Have a further read on MDN