tito11 tito11 - 5 months ago 22
jQuery Question

What is the difference between $.map and $.grep in jQuery

What is the difference between

$.map
and
$.grep
in jQuery?

I want a simple answer as far as possible.

Answer

I will assume you mean $.grep and $.map. The difference is that we use $.grep to filter an array while we use $.map to apply a function to each item in the array.

Here is a much better explanation than I can make:

http://onwebdev.blogspot.com/2011/03/jquery-grep-and-map-example-and-syntax.html