Slide 99
Slide 99 text
Inconsistency...
var
letters
=
[“a”,
“b”,
“c”,
“d”,
“e”];
$.each(letters,
function(index,
val)
{
console.log(index
+
“:
“
+
val.toUpperCase());
});
var
uppers
=
$.map(letters,
function(val,
index)
{
return
(val.toUpperCase());
});
$(‘li’).map(function(index,
val)
{
//WAT
});
Callback signatures on $.map, $.each & $(el).map
Not only do $.map and $.each diverge, but $.map and $(el).map order the
callback params differently, depending on how the method is called.
Friday, May 24, 13