Recently, I ran some of my JavaScript code through Crockford\'s JSLint, and it gave the following error:
Problem at line 1 character 1: Missing \"use
I strongly recommend every developer to start using strict mode now. There are enough browsers supporting it that strict mode will legitimately help save us from errors we didn’t even know were in your code.
Apparently, at the initial stage there will be errors we have never encountered before. To get the full benefit, we need to do proper testing after switching to strict mode to make sure we have caught everything. Definitely we don’t just throw use strict
in our code and assume there are no errors. So the churn is that it’s time to start using this incredibly useful language feature to write better code.
For example,
var person = {
name : 'xyz',
position : 'abc',
fullname : function () { "use strict"; return this.name; }
};
JSLint is a debugger written by Douglas Crockford. Simply paste in your script, and it’ll quickly scan for any noticeable issues and errors in your code.