javascript Set map code example

Example 1: append to map javascript

var myMap = {};

myMap[newKey] = newValue;

// ...


// Another method

var myMap = new Map()
myMap.set("key0","value")
// ...
myMap.has("key1"); // evaluates to false, assuming key1 wasn't set

Example 2: new map js

let utilisateurs = new Map()

utilisateurs.set('Mark Zuckerberg' ,{
    email: '[email protected]',
    poste: 'PDG',
})

utilisateurs.set ('bill Gates',{
    email: '[email protected]' ,
    poste : 'sauver le monde' ,

})
    
console.log(utilisateurs);

Example 3: map in javascript

['elem', 'another', 'name'].map((value, index, originalArray) => { 
  console.log(.....)
});