how to map not array objects code example
Example 1: map through keys javascript
var myObject = { 'a': 1, 'b': 2, 'c': 3 };
for (var key in myObject) {
if (myObject.hasOwnProperty(key)) {
myObject[key] *= 2;
}
}
console.log(myObject);
// { 'a': 2, 'b': 4, 'c': 6 }
Example 2: map a property from array of objects javascript
var result = objArray.map(function(a) {return a.foo;});