j s map code example
Example 1: js map constructor
let myMap = new Map([
[1, 'one'], // [key, value]
[2, 'two'],
[3, 'three'],
]) // from MDN
Example 2: javascript map
function listFruits() {
let fruits = ["apple", "cherry", "pear"]
fruits.map((fruit, index) => {
console.log(index, fruit)
})
}
listFruits()
// https://jsfiddle.net/tmoreland/16qfpkgb/3/