let arr = [1, 2, 3, 4, 3, 3, 3] console.log([...new Set(arr)]) // (4) [1, 2, 3, 4] let arr = [1, 2, 3, 4, 3, 3, 3, 'foo', true] console.log([...new Set(arr)]) //(6) [1, 2, 3, 4, 'foo', true]