map through object code example
Example 1: js map over object
var myObject = { 'a': 1, 'b': 2, 'c': 3 };
Object.keys(myObject).map(function(key, index) {
myObject[key] *= 2;
});
console.log(myObject);
Example 2: javascript iterate over object keys and values
const object1 = {
a: 'somestring',
b: 42
};
for (let [key, value] of Object.entries(object1)) {
console.log(`${key}: ${value}`);
}
Example 3: js map on object
import { map } from "ramda"
const double = x => x * 2;
const mappedObject = map(double, {x: 1, y: 2, z: 3});