How to remove duplicate values from an array
Set object can be used to remove duplicate values from an array.
const result = are.reduce((x, y) => x.includes(y) ? x : [...x, y], []);
const result = arr.filter((item, index) => {
return arr.indexOf(item) === index;
});
const arr = [1,4,7,8,1,9,4];
const result = [...new Set(arr)];Or
Or
Comments