#JS Algorithm Problems
Write a method no_dupes which will take an array and return that same array with all duplicate items removed. Assume integers. This should be done without using uniqueness methods like Ruby's uniq.
// No Dupes in action:
// no_dupes( [ 1, 4, 2, 7, 3, 1, 2, 8 ] ); // #=> [ 1, 4, 2, 7, 3, 8 ]
no_dupes( [ 100, 32, 44, 44, 23, 32, 44 ] ) // #=> [ 100, 32, 44, 23 ]
function no_dupes(arr) { //iterate through array i = 0; while (i <= arr.length - 1){ var elem = arr[i]; var firstIndex = arr.indexOf(elem); var secondIndex = arr.indexOf(elem,firstIndex+1); if (secondIndex !== -1){ arr.splice(secondIndex,1); } i++; } return arr; }