Javascript Array Map Method Callback Parameters
Javascript describes the map method syntax as: arr.map(callback[, thisArg]) Parameters callback - Function that produces an element of the new Array, taking three arguments: curre
Solution 1:
I'm not entirely clear on what you're asking but lets see if this is what you're looking for:
function capyyIt(names) {
names.map(function(value, index, collection){
capIt(val);
})
}
function capIt(name) {
return name.toUpperCase() + curr.slice(1).toLowerCase();
}
The map function takes a callback argument that uses the value, index, and collection as arguments, you can't change this. Therefore if you want to do something to each value being mapped, you should do it inside the callback function.
Post a Comment for "Javascript Array Map Method Callback Parameters"