One interesting example in my code.
var array=[[1,'a'],[1,'b'],[2,'c'],[2,'b'],[2,'d'],[3,'a'],[3,'s'],[3,'w'],[3,'q'],[4,'w']]
Desired output is as below:
1 a
b
2 c
b
d
3 a
This code snippet replaces duplicate numbers with an empty string.
Attempting this approach, which only compares two elements at a time.
for( var i=0; i<array.length-1; i++ ) {
if ( array[i][0] == array[i+1][0] ) {
array[i+1][0]='';
}
}