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

Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.