var arr = [1,2,3,4,1,2,6,7]; var tmp_arr = new Array(); for (i = 0; i < arr.length; i++) { if (tmp_arr.indexOf(arr[i]) == "-1") { tmp_arr.push(arr[i]); } } alert(tmp_arr);