1

Ho do I remove same values in an array has?

example code:

const array = [10, 20, 30, 40, 20, 70, 10 ]

Expected output:

const outputArray = [30, 40, 70];

I can remove the duplicate value. But how to remove both the duplicate values.

Duplicate remove code:

const removeDuplicate = [...new Set(array)];

After the removed duplicate output is below mentioned.

const outputArray = [10, 20, 30, 40, 70];

But I want to remove both the duplicate values and will get the expected output

const outputArray = [30, 40, 70];
imjayabal
  • 805
  • 1
  • 12
  • 24

0 Answers0