Skip to content

Instantly share code, notes, and snippets.

@ancyrweb
Created January 14, 2022 05:34
Show Gist options
  • Save ancyrweb/33dcd458fb8722dd4ee1fda99fc85179 to your computer and use it in GitHub Desktop.
Save ancyrweb/33dcd458fb8722dd4ee1fda99fc85179 to your computer and use it in GitHub Desktop.
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.find(withId(1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment