Created
January 12, 2015 18:32
-
-
Save hyharryhuang/2c61633f24e1e983784b to your computer and use it in GitHub Desktop.
Iterate through javascript Objects
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
for (var key in p) { | |
if (p.hasOwnProperty(key)) { //make sure key is part of this object, not coming from a prototype. | |
alert(key + " -> " + p[key]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment