javascript中去掉数组中的重复项方法:var str=['hello','node','element','node','hello','blue','red'];var str1=[];function first(args){for(i=0;iif(str1.indexOf(args[i])<0){str1.push(args[i])}}return str1;}first(str);console.log(str1)