They both perform an iteration. Yet in $.each the first parameter
is the index, while in $.map the index is the second parameter.
Why the inconsistency? I use both functions and I constantly
have to remind myself the order.
I would rather them both be function(value, index). I'm
constantly having to write this:
- $.each(arr,
function(dontCare, value) {
-
// do something
- });
I'm willing to bet more people care about the value not the
index. Any idea why they arranged the parameter order like this?