去掉js数组中反复的数据

去掉js数组中重复的数据
for(var j=0;j<temp.length;j++){
    for(var f=j+1;f<temp.length;f++){
         if(temp[j]==temp[f]){
	     temp.splice(j,1);
            j--;
	     break;
      }
   }
}