What is the difference between $.map and $.grep in jQuery?
I want a simple answer as far as possible.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I will assume you mean
$.grepand$.map. The difference is that we use$.grepto filter an array while we use$.mapto 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