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 = [1, 2, 3, 4, 5];
2
3const bigNumbers = numbers.map(number => {
4 return number * 10;
5});
1const map = new Map();
2
3function foo() {
4 return "Hello World!";
5}
6
7map.set("foo", foo);
8
9console.log(map.get("foo")()); // Output: "Hello World!
1['elem', 'another', 'name'].map((value, index, originalArray) => {
2 console.log(.....)
3});