There is an array, in that array there is an id, if id is repeated twice in the loop, remove the id from the array
Asked
Active
Viewed 38 times
-4
-
1If you want to have a unique values in the array you can do: `var uniqueArray = [...new Set(myArray)]` – wawka Jun 03 '22 at 10:53
-
1is it an array of Objects or Numbers/Strings? – vsync Jun 03 '22 at 11:06
1 Answers
-1
use set
let chars = ['A', 'B', 'A', 'C', 'B'];
let unique = [...new Set(chars)];
console.log(unique);
you will get output like this-> [ 'A', 'B', 'C' ]
rithuwa
- 39
- 5