1var myMap = {};
2
3myMap[newKey] = newValue;
4
5// ...
6
7
8// Another method
9
10var myMap = new Map()
11myMap.set("key0","value")
12// ...
13myMap.has("key1"); // evaluates to false, assuming key1 wasn't set
1function listFruits() {
2 let fruits = ["apple", "cherry", "pear"]
3
4 fruits.map((fruit, index) => {
5 console.log(index, fruit)
6 })
7}
8
9listFruits()
10
11// https://jsfiddle.net/tmoreland/16qfpkgb/3/
1const numbers = [0,1,2,3];
2
3console.log(numbers.map((number) => {
4 return number;
5}));