Skip to content

Instantly share code, notes, and snippets.

@ar2zee
Created May 30, 2017 17:03
Show Gist options
  • Save ar2zee/d5d20ac6c29cfba28f6ddfc8ed810716 to your computer and use it in GitHub Desktop.
Save ar2zee/d5d20ac6c29cfba28f6ddfc8ed810716 to your computer and use it in GitHub Desktop.
example filter function wih array
var animals = [
{name : 'artur', food: 'potatoes'},
{name : 'sergey', food: 'fries'},
{name : 'anton', food: 'fries'},
{name : 'petya', food: 'cream'},
{name : 'oksana', food: 'chips'},
{name : 'lesya', food: 'meat'},
{name : 'julya', food: 'vegies'},
{name : 'sasha', food: 'sour_cream'}
];
var fries = animals.filter(function(animal) {
return animal.food === 'fries';
});
console.log(fries);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment