javascript value in map code example
Example 1: javascript map
function listFruits() {
let fruits = ["apple", "cherry", "pear"]
fruits.map((fruit, index) => {
console.log(index, fruit)
})
}
listFruits()
// https://jsfiddle.net/tmoreland/16qfpkgb/3/
Example 2: javascript map
const numbers = [0,1,2,3];
console.log(numbers.map((number) => {
return number;
}));