const arr = [[1, 2], [1, 2], [3, 4], [7, 7]];
how to remove duplicate arrays from the given array? The first two elements of the array are the same. I couldn't fix it with the set.
Use method filter()
.
const arr = [[1, 2], [1, 2], [3, 4], [7, 7]];
const arrNoDouble = arr.filter((a = {}, b => !(a[b] = b in a)));
console.log(JSON.stringify(arrNoDouble));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With