1 //数组去重 2 function arrayOnly(array) { 3 var tmp = new Array(); 4 5 for (var m in array) { 6 tmp[array[m]] = 1; 7 } 8 //再把键和值的位置再次调换 9 var tmparr = []; 10 11 for (var n in tmp) { 12 tmparr.push(n); 13 } 14 return tmparr; 15 }