Skip to content

Instantly share code, notes, and snippets.

@mim-Armand
Last active August 29, 2015 14:04
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 mim-Armand/f7f1015d040969b52b82 to your computer and use it in GitHub Desktop.
Save mim-Armand/f7f1015d040969b52b82 to your computer and use it in GitHub Desktop.
getting an array of Object properties in older Versions of JavaScript
Object.objToArray = function(obj) {
var array = [];
for (key in obj) {
if (obj.hasOwnProperty(key)) array.push(key);
}
return array;
};
alert(Object.objToArray(YourObject));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment