//JavaScript判断数组是否包含指定元素的方法 Array.prototype.contains = function(needle) { for(i in this) { if(this[i] == needle) return true; } return false; } // 求两个数组的不相同元素 function ArrydifferentE(a, b) { var c = []; var tmp = a.concat(b); var o = {}; for (var i = 0; i < tmp.length; i ++) (tmp[i] in o) ? o[tmp[i]] ++ : o[tmp[i]] = 1; for (x in o) if (o[x] == 1) c.push(x); return(c); }