Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数组去重 #14

Open
lensh opened this issue Aug 10, 2017 · 0 comments
Open

数组去重 #14

lensh opened this issue Aug 10, 2017 · 0 comments

Comments

@lensh
Copy link
Owner

lensh commented Aug 10, 2017

ES6实现:
[...new Set([1,2,3,1,'a',1,'a'])]

ES5实现:

[1,2,3,1,'a',1,'a'].filter(function(ele,index,array){
    return index===array.indexOf(ele)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant