Skip to content

Instantly share code, notes, and snippets.

@aspencer8111
Created June 21, 2016 16:01
Show Gist options
  • Save aspencer8111/fbe430aa819d4aeeb1670d5d6dcc58dc to your computer and use it in GitHub Desktop.
Save aspencer8111/fbe430aa819d4aeeb1670d5d6dcc58dc to your computer and use it in GitHub Desktop.
See available properties (with or without chain) on a Javascript Object
// See a list of properties for a givin oject (includeing all in prototype chain)
for(var prop in obj){
console.log(prop ": " + obj[prop])
}
// See only properties in the object (no protochain)
for(var prop in obj){
if (obj.hasOwnProperty(prop)){
console.log(prop ": " + obj[prop])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment