Array.prototype.isRepeat = function(str){
var i = this.length;
while(i){
i--;
if(this[i]==str){
return true;
}
}
return false;
}
###############用法
let arr = [1,2,3,4,5,6,7];
var str = 4;
console.log(arr.isRepeat (str)) //true
网友评论