Created
August 19, 2017 21:03
-
-
Save prof3ssorSt3v3/8494cc224bb6e2d3c6adde613ab97725 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for..of loops | |
// for..of versus for..in loops | |
let supernatural = { | |
"actors":['Jared Padelecki', 'Jensen Ackles', 'Mark Sheppard', 'Misha Collins'], | |
"characters":['Sam Winchester', 'Dean Winchester', 'Crowley', 'Castiel'], | |
"seasons":12 }; | |
for( prop in supernatural){ | |
console.log( prop, typeof supernatural[prop], | |
Array.isArray(supernatural[prop]) ); | |
} | |
for( prop in supernatural.actors){ | |
console.log(prop, supernatural.actors[prop]); | |
} | |
for( name of supernatural.actors){ | |
console.log( name ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment