Skip to content

Instantly share code, notes, and snippets.

@ClausClaus
Created April 4, 2020 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ClausClaus/aa6d0124b5d340995471215ae64ea61e to your computer and use it in GitHub Desktop.
Save ClausClaus/aa6d0124b5d340995471215ae64ea61e to your computer and use it in GitHub Desktop.
数组去重
const array = [1,23,124,23,4,1.423,4,123,222,111,22,23];
[...new Set(array)]
array.filter((item,index)=>array.indexOf(item) === index)
array.reduce((unique,item) => unique.includes(item) ? unique: [...unique,item],[])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment