function uniqueArr(arr) { var temp = {}; var result = []; for (var i = 0, j = arr.length; i < j; i++) { if (!temp[arr[i]]) { temp[arr[i]] = true; result.push(arr[i]); } } return result; } var testArr = [1, 1, 2, 2, 2, 3, 3, 5, 6, 1]; console.log(uniqueArr(testArr)); function delete_repeat(arr) { return [...new Set(arr)] } var arr = [1, 2, 3, 6, 2, 6, 5]; console.log(delete_repeat(arr));