Skip to content

Instantly share code, notes, and snippets.

@zlrlo
Created November 15, 2022 09:52
Show Gist options
  • Select an option

  • Save zlrlo/9b89929029874272ca67ca565ecdf3d9 to your computer and use it in GitHub Desktop.

Select an option

Save zlrlo/9b89929029874272ca67ca565ecdf3d9 to your computer and use it in GitHub Desktop.
javascript trick - 배열 중복 제거
const names = ['Lee', 'Kim', 'Park', 'Lee', 'Kim'];
const uniqueNamesWithSpread = [...new Set(names)];
@zlrlo

zlrlo commented Nov 15, 2022

Copy link
Copy Markdown
Author
console.log(uniqueNamesWithSpread);

// output
[ 'Lee', 'Kim', 'Park' ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment