js what is map mwrhods 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: map in javascript
['elem', 'another', 'name'].map((value, index, originalArray) => {
console.log(.....)
});