Created
June 28, 2016 23:49
-
-
Save fijiwebdesign/6772bce5806db30e4b37a3fd8cb55e0e to your computer and use it in GitHub Desktop.
Keys of an Object
This file contains hidden or 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
// object | |
var Person = { | |
name: 'mr smith', | |
profession: 'dandy fella', | |
age: 10000 | |
} | |
// array of keys of Person | |
var properties = Object.keys(Person); | |
console.log(properties); // ['name', 'profession', 'age'] | |
properties.forEach(function(prop) { | |
console.log(prop); // name ... profession ... age | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment