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

Author: Joseph Dickson

Joseph Dickson is a front-end web developer with experience building higher education websites using Drupal and WordPress.