Array.prototype.myMap definition

Just did the Array.prototype.myMap implementation challenge : freeCodeCamp Challenge Guide: Implement map on a Prototype

I could not finish it without looking at the solution. I found it quite tricky because achieving it needed to understand that Array.prototype.myMap() callback function passes 3 arguments : the item on which the callback is performed, the index of this item and the full array. Even on the MDN page it is not clear that the 3 arguments are needed in the implementation and I quite not got it until in the “example” part of the documentation. I even had to go to the ECMAScript specification to have a clearer understanding of the subject.

The precedent challenge introducing did not explained it either.

Is it possible to add something in the challenge description to make it clearer that the callback function needs 3 arguments ?
I think the MDN page need a clearer description too, and opened an issue on GitHub (my first :partying_face:) (I did not wanted to go too deep in the GitHub pull request rabbithole for now).

Do you think I am right or is this a feature of the curriculum ?
I am sure unclear implementation are frequent and it made me search, which is nice, but I wasn’t able to find the solution by myself and maybe this makes the learning curve a bit too steep.

Anyway, thanks a lot FCC, I definitively learnt something today ! :muscle: :pray:

1 Like

I think you maybe overlooked this

When the callback is used, it is passed three arguments. The first argument is the current element being processed. The second is the index of that element and the third is the array upon which the map method was called.

1 Like

I did overlooked that.
It may be useful to remind it in the task but indeed not necessary.
Sorry for the fuss and thanks for the reply !

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.