javascript map
by NunoMira
JavaScript
function listFruits() {
let fruits = ["apple", "cherry", "pear"]
fruits.map((index) => {
alert(index, fruit)
})
}
listFruits()
/*
output to console
0, "apple"
1, "cherry"
2, "pear"
*/
by NunoMira
function listFruits() {
let fruits = ["apple", "cherry", "pear"]
fruits.map((index) => {
alert(index, fruit)
})
}
listFruits()
/*
output to console
0, "apple"
1, "cherry"
2, "pear"
*/