Hello, how are you? I'm trying to develop a function in javascript that gets an array of integers, and removes from the array only the repeated terms, I know there are pre-determined functions for this, but I'm testing developing develop in a more "handy" way, could they help me? I'm having some difficulty.
follow what I tested:
var array_teste = [4, 1, 2, 2, 3, 4, 5, 5, 7, 8, 8, 15];//array de teste para a função
function remove_repetidos(arr) {
for (var i = 0; i < arr.length; i++) {
var teste = arr[i];
console.log(teste);
for (var j = 1; i < arr.length; j++) {
if (arr[j] == teste){
arr.splice(j, 1);
};
};
};
}
console.log(array_teste);
remove_repetidos(array_teste);
console.log(array_teste);