编写一个方法去掉数组里面重复的内容 var arr=['abc','abcd','sss','2','d','t','2','ss','f','22','d'];
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));