on-internet
← Community

JavaScript Array#map: index argument

Stack Overflow ·

My question is about the map method of arrays in JavaScript. You can pass it a function that takes a second argument, the index of the current element of the array being processed, but... to what purpose? What happens when you do it and what's the difference when you don't? What would you use this feature for?

Comments

Sign in or sign up to comment and upvote.

No comments yet.