If I have an array in a JavaScript variable that I want to iterate through, I usually use jQuery's .each() function like this:
var myArray = ["foo", "bar"];
$(myArray).each(function(index, value) {
console.log(value);
});
But I can achieve the same effect by passing in my array as an argument to the .each() function, like this:
var myArray = ["foo", "bar"];
$.each(myArray, function(index, value) {
console.log(value);
});
Obligatory but unnecessary JSFiddle
This question can apply to basically any other jQuery function as well, not just .each(). Is there a functional difference between these two different usages?