Please read the question before marking it as repeated, thanks.
What I need is that if there are duplicate elements in the array, remove them all. The array is something similar to this:
var array = [[1,2],
[2,3], // repetido
[3,4],
[4,5],
[2,3], // repetido
[5,6],
[6,7], // repetido
[6,7], // repetido
[7,8]]
so it would be like this:
var array = [[1,2],
[3,4],
[4,5],
[5,6],
[7,8]]
In the array there can be a minimum of 1000 values, so nesting a for loop in another, and checking value by value is not efficient, the browser closes and the processor is set to 90%
The iteration of the Array must occur only 1 time, for each iterated element we must evaluate in a new one
array
if it already exists or not.The explanation is in the code, the functions used are some() to verify that it exists or not in the array, and splice() to remove
array
duplicate elements.You can try this:
The easiest way I could think of was to serialize the array value and store if it was already found. Font