Skip to content

Instantly share code, notes, and snippets.

@mannuelf
Created January 1, 2017 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mannuelf/1174b4f319b5335231171bfe31da95fe to your computer and use it in GitHub Desktop.
Save mannuelf/1174b4f319b5335231171bfe31da95fe to your computer and use it in GitHub Desktop.
Handling Permissions with Filter
const users = [
{ id: 1, admin: true },
{ id: 2, admin: false },
{ id: 3, admin: false },
{ id: 4, admin: false },
{ id: 5, admin: true },
];
let filteredUsers = users.filter(function(user) {
return user.admin === true;
});
console.log(filteredUsers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment