Which array method returns a new array containing the result of calling a function on every element?
Correct answer
A. map()
15 views
A. map()
15 views
map() transforms each element and returns a new array of the same length. forEach() returns undefined, filter() keeps only matching elements, and reduce() combines them into a single value.
Asked in: Frontend Developer Tests, Technical Interviews
Not sure why the answer is A? Ask here and get an explanation.