博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
underscore.js _.include [Collections]
阅读量:4646 次
发布时间:2019-06-09

本文共 561 字,大约阅读时间需要 1 分钟。

Returns true if the value is present in the list, using === to test equality. UsesindexOf internally, if list is an Array.

检测值是否在列表中出现过,如果出现返回true

1 _.include([1, 2, 3], 3);2 => true

源码:

1  _.include = _.contains = function(obj, target) {2     var found = false;3     if (obj == null) return found;4     if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;5     found = any(obj, function(value) {6       return value === target;7     });8     return found;9   };

 

 

 

 

转载于:https://www.cnblogs.com/himan/archive/2012/04/23/2467097.html

你可能感兴趣的文章
ConcurrentHashMap实现原理及源码分析
查看>>
PowerDesigner 中将Comment(注释)及Name(名称)内容互相COPY的VBS代码
查看>>
luacom cygwin
查看>>
浅谈WPF的VisualBrush
查看>>
CSS------当内容超出div宽度后自动换行和限制文字不超出div宽度和高度
查看>>
经常用得到的安卓数据库基类
查看>>
简单入门dos程序
查看>>
vue element 关闭当前tab 跳转到上一路由
查看>>
4、面向对象
查看>>
[NOI2005]聪聪与可可(期望dp)
查看>>
POJ 3723
查看>>
Maven的安装
查看>>
angular初步认识一
查看>>
springmvc3.2+spring+hibernate4全注解方式整合(一)
查看>>
Elgg网站迁移指南
查看>>
素数筛法优化
查看>>
installshield 注册dll
查看>>
Sublime Text 3 及Package Control 安装(附上一个3103可用的Key)
查看>>
LTE QCI分类 QoS
查看>>
Get MAC address using POSIX APIs
查看>>