Array.prototype.S = String.fromCharCode(2);
Array.prototype.in_array = function (e) {
var r = new RegExp(this.S + e + this.S);
return (r.test(this.S + this.join(this.S) + this.S));
};
var ary = new Array(1,2,‘aaa‘,‘bbbb‘,5);
alert(ary.in_array(3)); //false
alert(ary.in_array(2)); //true
时间: 2024-11-09 06:16:51