Skip to content

Instantly share code, notes, and snippets.

@mim-Armand
Last active August 29, 2015 14:04
Embed
What would you like to do?
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