1let utilisateurs = new Map()
2
3utilisateurs.set('Mark Zuckerberg' ,{
4 email: 'mark@facebook.com',
5 poste: 'PDG',
6})
7
8utilisateurs.set ('bill Gates',{
9 email: 'billgates@notes.com' ,
10 poste : 'sauver le monde' ,
11
12})
13
14console.log(utilisateurs);
1let map = new Map()
2map['bla'] = 'blaa'
3map['bla2'] = 'blaaa2'
4
5console.log(map) // Map { bla: 'blaa', bla2: 'blaaa2' }
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});
1// The map() method creates a new array populated with the
2// results of calling a provided function on every element
3// in the calling array.
4const array1 = [1, 4, 9, 16];
5
6// pass a function to map
7const map1 = array1.map(x => x * 2);
8
9console.log(map1);
10// expected output: Array [2, 8, 18, 32]