let RepeatingItemList = [3, 'a', 'a', 4, 3, 'b', 'A', 'b', 'c', 4, 6, 9, 8, 'b', 'a', 2, 6, 3];
let index = 0;
let compareIndex;
IndexLength = RepeatingItemList.length;
while (index < IndexLength) {
compareIndex = index + 1;
while (compareIndex < IndexLength) {
if (RepeatingItemList[index] == RepeatingItemList[compareIndex]) {
RepeatingItemList.splice(compareIndex, 1);
}
compareIndex++;
}
index++;
}
console.log(RepeatingItemList);
You could take an object for keeoing track of the seen items and normalize them before to a lower case string.
For removing unwanted items, you could use another variable for the new length of the array, which is the target for copy the item from the actual index to a closer position to start without unwanted items. At the end adjust the length of the array.
const
remove = array => {
const
normalize = v => v.toString().toLowerCase(),
seen = {};
let l = 0,
i = 0;
while (i < array.length) {
if (!seen[normalize(array[i])]) array[l++] = array[i];
seen[normalize(array[i])] = true;
i++;
}
array.length = l;
},
array = [3, 'a', 'a', 4, 3, 'b', 'A', 'b', 'c', 4, 6, 9, 8, 'b', 'a', 2, 6, 3];
remove(array);
console.log(...array);