Last active
August 28, 2019 18:45
-
-
Save Kamilnaja/0a922aa350da2e6f6f684137a69efc91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// so, you have list of users like this | |
const users = [ | |
{ id: '1', name: 'hello' }, | |
{ id: '2', name: 'world' }, | |
{ id: '3', name: 'hello' }, | |
{ id: '1', name: 'hello' }, | |
{ id: '1', name: 'hello' }, | |
] | |
// as a result, we want to get list of users without duplicates, basing on id. | |
const res = [ | |
{ id: '1', name: 'hello' }, | |
{ id: '2', name: 'world' }, | |
{ id: '3', name: 'hello' } | |
] | |
// I suggest you, not to use forEach or for methods. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment