//数组是否存在某一对象
Array.prototype.contains = function(obj) {
this.obj = obj;
var that = this;
function isExist() {
for (var i = 0, j = that.length; i < j; i++) {
if (that[i] == obj) {
return true;
}
}
return false;
}
return isExist();
}
本文介绍了一种在JavaScript数组中查找特定元素的方法,通过自定义函数实现数组元素的查找。

8447

被折叠的 条评论
为什么被折叠?



