JSLint is not passing this as a valid code:
/* global someVar: false */ if (typeof someVar === "undefined") { var someVar = "hi!"; }
What is the correct way?
/*global window */ if (window.someVar === undefined) { window.someVar = 123456; } if (!window.hasOwnProperty('someVar')) { window.someVar = 123456; }
2.1m questions
2.1m answers
60 comments
56.9k users