Tuesday, March 10, 2015

What is a simple explanation of higher order functions and callbacks in JavaScript?

  { name: 'Waffles'type: 'dog', age: 12 },
  { name: 'Fluffy',   type: 'cat', age: 14 },
  { name: 'Spelunky', type: 'dog', age: 4 },
  { name: 'Hank',     type: 'dog', age: 11 },
];
var oldDogs = animals.filter(function(animal) {
  return animal.age > 10 && animal.type === 'dog';
});

No comments:

Post a Comment