Skip to content

Instantly share code, notes, and snippets.

@fijiwebdesign
Created June 28, 2016 23:49
Show Gist options
  • Save fijiwebdesign/6772bce5806db30e4b37a3fd8cb55e0e to your computer and use it in GitHub Desktop.
Save fijiwebdesign/6772bce5806db30e4b37a3fd8cb55e0e to your computer and use it in GitHub Desktop.
Keys of an Object
// 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