This is the description for the arguments accepted by Callback functions. It has been explained multiple times throughout the course but causes more confusion than clarity.
The callback function accepts 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 filter method was called.
See below for an example using the filter method on the users array to return a new array containing only the users under the age of 30. For simplicity, the example only uses the first argument of the callback.
(It would be appreciated if the upper paragraph had an example of utilizing the three arguments.)
I hear what you are saying, but I actually think that might be a bad idea. I can’t remember the last time I used that third argument. I did a few times when I was first learning, but that was usually because I was doing something incorrectly. Off the top of my head I can’t even think of a good use case.
I think showing that might encourage bad practices. If anything I would want text that said, “Typically you will only need the first parameter and occasionally the second. You will not normally use the third.”
But as kevinSmith already said, you’ll almost never need the third parameter, sometimes the second, and always the first. I needed the third exactly once with .reduce, but can’t remember the details.
The introduction to the concept of Arrow Functions is short, quick, and kind of glosses over the syntax usage. The example in the challenge lesson is somewhat simplistic.
For whatever reason, that is the only thing that tripped me up in challenges 1 & 2 above. All of the other concepts presented made sense to me.