JavaScript 2025 · Arrays

Remove duplicates

Convert to a Set and back to an array.

const unique = [...new Set(items)];

Official JavaScript 2025 documentation

More arrays commands

All arrays commands · JavaScript 2025 cheatsheet

Was this page helpful?