javascript map click index 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: array mdn map
let new_array = arr.map(function callback( currentValue[, index[, array]]) {
// return element for new_array
}[, thisArg])