Created
June 21, 2016 16:01
-
-
Save aspencer8111/fbe430aa819d4aeeb1670d5d6dcc58dc to your computer and use it in GitHub Desktop.
See available properties (with or without chain) on a Javascript 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
// 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