Possible Duplicate:
Remove duplicates from an array of objects in javascript
I'm trying to remove any duplicates in an array. For example if I have 112233
I want to return only 123
.
My code:
function array_unique(array) {
var array_length = array.length;
var new_array = [];
for (var i = 0; i < array_length; i++) {
if (array[i] == array[i + 1]) {
}
new_array.push(array[i]);
}
return new_array;
}
I don't know what to type in the if so I can remove the doubles