直接上代码
var arr = [2, 3, 4, 4, 5, 2, 3, 6], arr2 = []; for (var i = 0; i < arr.length; i++) { if (arr2.indexOf(arr[i])<0) { arr2.push(arr[i]); } } console.log(arr2);
直接上代码
var arr = [2, 3, 4, 4, 5, 2, 3, 6], arr2 = []; for (var i = 0; i < arr.length; i++) { if (arr2.indexOf(arr[i])<0) { arr2.push(arr[i]); } } console.log(arr2);
转载于:https://www.cnblogs.com/chenmiaosong/p/8422940.html