I'm trying to do something interesting in JavaScript, but I can't. This is my input:
var Input = ['a','a','a','b','b','b','b','c','c','c','a','a','c','d','d','d'];
So my output is that only get differents values and go in a new vector.
var Output = SomeFunction(Input);
This is what I want:
Output = ['a','b','c','a','c','d'];
Y tried with this, but don't work aswell:
function SomeFunction(input){
var out= [];
for (var i = 0; i < input.length - 1; i++) {
if(input[i] == input[i+1]){
out.push(input[i]);
}
}
return out;
}