Return to Snippet

Revision: 53209
at November 16, 2011 06:40 by luizlopes


Initial Code
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
    }
}

Initial URL
http://www.jslint.com/lint.html#for%20in

Initial Description
JSLint requires the body of every `for in` statement should be wrapped in an `if` statement

Initial Title
Iterating over the properties of an object

Initial Tags
javascript, script

Initial Language
JavaScript