js 判断数组中是否有重复值
function arrHasvalue(arr) { var nary = arr.sort(); for (var i = 0; i < arr.length; i++) { if (nary[i] == nary[i + 1]) { // console.log("数组重复内容:" + nary[i]); return true; }else{ return false; } } }
var ary = new Array("111", "22", "33", "111");
console.log(arrHasvalue(ary)); //true