jQuery中$ .map和$ .grep有什么区别 [英] What is the difference between $.map and $.grep in jQuery

查看:153
本文介绍了jQuery中$ .map和$ .grep有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery中 $。map $。grep 之间有什么区别?

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

我想尽可能简单的答案。

I want a simple answer as far as possible.

推荐答案

我会假设你的意思是 $。grep $。map 。区别在于我们使用 $。grep 来过滤数组,同时我们使用 $。map 来应用函数数组中的每个项目。

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

这篇关于jQuery中$ .map和$ .grep有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆