javascript map array of objects get key
var foo = { 'alpha': 'puffin', 'beta': 'beagle' }; var keys = Object.keys(foo); console.log(keys) // ['alpha', 'beta'] // (or maybe some other order, keys are unordered).
Here is what the above code is Doing:
1. We create an object called foo.
2. We call Object.keys(foo) to get an array of the keys in foo.
3. We log the array to the console.