Skip to content

Instantly share code, notes, and snippets.

@hebertcisco
Created May 23, 2020 05:24
Show Gist options
  • Save hebertcisco/2e448b0d3a85fcd8e15c7d3ab5a28a27 to your computer and use it in GitHub Desktop.
Save hebertcisco/2e448b0d3a85fcd8e15c7d3ab5a28a27 to your computer and use it in GitHub Desktop.
Say if all users are authorized using age as a parameter:
const ageUser = [
{
name: "Jane Dow",
age: 39,
},
{
name: "John Doe",
age: 39,
},
{
name: "Rebecca Flex",
age: 16,
},
];
const authorizedUser = (valueGet) => valueGet.age >= 18;
const adductOnly = ageUser.every(authorizedUser);
console.log(adductOnly);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment