1var myObject = { 'a': 1, 'b': 2, 'c': 3 };
2
3Object.keys(myObject).map(function(key, index) {
4 myObject[key] *= 2;
5});
6
7console.log(myObject);
8// => { 'a': 2, 'b': 4, 'c': 6 }
1//map() methods returns a new array
2const data = {name: "laptop", brands: ["dell", "acer", "asus"]}
3let inside_data = data.brands.map((i) => {
4 console.log(i); //dell acer asus
5});
1import { map } from "ramda"
2
3const double = x => x * 2;
4
5const mappedObject = map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}