Reputation: 6216
What is the purpose of the second argument in the callback function .map()
?
I think it is not necessary because you can use this
instead:
> $('p').map(function (index, element) {
return this===element;
});
[true, true, true, true]
Upvotes: 0
Views: 108
Reputation: 339816
On useful feature is that if you call another closure inside the callback you've still got a "ready made" reference to the element, since this
wouldn't be correct anymore.
Upvotes: 5