/ Published in: JavaScript
JSLint requires the body of every `for in` statement should be wrapped in an `if` statement
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var buz = { fog: 'stack' }; for (var name in buz) { if (buz.hasOwnProperty(name)) { alert("this is fog (" + name + ") for sure. Value: " + buz[name]); } else { alert(name); // toString or something else } }
URL: http://www.jslint.com/lint.html#for%20in