DEV Community

Discussion on: Implementation of ES6 Map() function

Collapse
 
mateiadrielrafael profile image
Matei Adriel

The map function needs to get the current value, index and array. Also, why that var? Tha can become a const

Collapse
 
prashantandani profile image
Prashant Andani • Edited

Updated... Thanks for pointing that out... 'Const' should do and also I missed index.

Map will pass the current value to the callback function which in this case is 'fn', which has 'currentValue' and 'index' as a parameter...