array.map((item) => { return item * 2 } // an example that will map through a a list of items and return a new array with the item multiplied by 2
let map = new Map() map['bla'] = 'blaa' map['bla2'] = 'blaaa2' console.log(map) // Map { bla: 'blaa', bla2: 'blaaa2' }
['elem', 'another', 'name'].map((value, index, originalArray) => { console.log(.....) });
const objectMap = (obj, fn) => Object.fromEntries( Object.entries(obj).map( ([k, v], i) => [k, fn(v, k, i)] ) ) const myObject = { a: 1, b: 2, c: 3 } console.log(objectMap(myObject, v => 2 * v))