map function demo code example
Example 1: map function demo
const array = [2, 5, 9];
let squares = array.map((num) => num * num);
console.log(array);
console.log(squares);
Example 2: Map Javascript - Example
let contacts = new Map()
contacts.set('Jessie', {phone: "213-555-1234", address: "123 N 1st Ave"})
contacts.has('Jessie')
contacts.get('Hilary')
contacts.set('Hilary', {phone: "617-555-4321", address: "321 S 2nd St"})
contacts.get('Jessie')
contacts.delete('Raymond')
contacts.delete('Jessie')
console.log(contacts.size)