Object.keys()
method returns an array of a given object's own enumerable properties, in the same order as that provided by a for...in
loop (the difference being that a for-in loop enumerates properties in the prototype chain as well).src
And this is how you iterate the keys of an array:
Object.keys(myArray).forEach(function (key) {
// do something with obj[key]
});
src