function noRepeat(arr) { var arr1 = []; for (var i = 0; i < arr.length; i++) { var item = arr[i]; if (arr1.indexOf(item) === -1) arr1.push(item); } return arr1; } console.log(noRepeat(arr));
function noRepeat(arr) { var arr1 = []; for (var i = 0; i < arr.length; i++) { var item = arr[i]; if (arr1.indexOf(item) === -1) arr1.push(item); } return arr1; } console.log(noRepeat(arr));
转载于:https://www.cnblogs.com/wuqilang/p/11367016.html