比如一个数组[1,2,3,4] 变量a从1循环到5,怎么把5这个数取出来
Array.prototype.mycontains = function(e) { for(i=0;i<this.length;i++) { if(this[i] == e) return true; } return false; } 然后这么用 for (var i = 0; i <= 5; i++) if (!arr.mycontains(i)) alert(i);