var arr1 = ['green' , 'yellow' ,'blue' ,'red']; var arr2 = ['lightlue' , 'red' , 'pink']; var arr3 = ['yellow' ,'blue' ,'red', 'green']; arr1.push(...arr2); var arrset1 = new Set(arr1); if([...arrset1].length == arr2.length){ alert("arr1和arr2两个数组相等"); }else{ alert('arr1 和arr2 两个数组不相等'); }