douglascrockford/JSLint — Issue #83: Undefined unused
Author: mattyclarkson
Created: 2011-10-26 11:21:37+00:00
State: open

Douglas,

Putting the following through JS lint:

/*jslint
browser:	true,
es5:	true,
maxerr:	50,
indent:	4,
*/

(function (window, undefined) {
'use strict';
var console = window.console;
window.helloWorld = function () {
if (console !== undefined) {
console.log('Hello World!');
}
};
}(window));

returns:

Error:
Unused variable: undefined 8 'anonymous'

This design pattern forces `undefined` to `undefined` but JS lint ignores the use of undefined in the comparison:

if (console !== undefined)

I'm not a Javascript guru so cannot make an informed decision either way. I hope you can help.