首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

给数组对象增添contains方法:是否包某一对象

2012-11-22 
给数组对象添加contains方法:是否包某一对象????????//数组是否存在某一对象Array.prototype.contains f

给数组对象添加contains方法:是否包某一对象
????????//数组是否存在某一对象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();}

热点排行