二维数组去重
let arr = [ [1, 45, 5, 4, 78, 48, 78, 98, 7, 120], [10, 41, 57, 4, 81, 48, 98, 58, 7, 120] ]; // 接受 二维数组 转变 一维数组之后的值 let arr1 = []; for (let i = 0; i < arr.length; i++) { arr1.push(...arr[i]) } // 这个接收排除完成之后的值 let arr2 = []; for (let j = 0; j < arr1.length; j++) { for (let c = j; c < arr1.length; c++) { if (arr2.indexOf(arr1[c]) == -1) { arr2.push(arr1[c]) } } } console.log(arr1); console.log(arr2);