Javascript Loop

Day Two – Loops

Took a look at the for and for / in loops and how they’re used in variables and objects to pull information.

var warGoodForObject = {
"what": "nothing",
"who": "no one"
};
for( var name in warGoodForObject ) {
console.log ( name + ": " + warGoodForObject[name] );
}

Results in console:
what: nothing
who: no one

Leave a Reply

Your email address will not be published. Required fields are marked *