Skip to content

Instantly share code, notes, and snippets.

@hyharryhuang
Created January 12, 2015 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyharryhuang/2c61633f24e1e983784b to your computer and use it in GitHub Desktop.
Save hyharryhuang/2c61633f24e1e983784b to your computer and use it in GitHub Desktop.
Iterate through javascript Objects
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