Created
January 14, 2022 05:39
-
-
Save ancyrweb/9e613b6bf180068e6ddb2b74244abd7e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const users = [ | |
{ | |
id: 1, | |
username: "supercoder", | |
}, | |
{ | |
id: 2, | |
username: "xXxSniperElitexXx", | |
}, | |
{ | |
id: 3, | |
username: "sPoNgEbOb_cAsE", | |
} | |
]; | |
const withId = (id) => (user) => user.id === id; | |
const userWithId = users.findIndex(withId(1)); // 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment