I want to remove elements that occurr more than once and get the unique element. The array always has 3 elements.
Lets say i have an array [2,3,2], then I need to get 3 whi
var a = [2,3,2], result = [];
for(var i = 0; i < a.length; i++){
if(getAllIndexes(a, a[i]).length === 1)
result.push(a[i]);
}
console.log(result);
function getAllIndexes(arr, val) {
var indexes = [], i = -1;
while (~(i = arr.indexOf(val, i+1)))
indexes.push(i);
return indexes;
}