title: In .filter() how do I make a callback function call another function?
body: <p>I'm trying to get the hang of <code>callback functions</code> but I've ran into something that I don't fully understand.</p>
  
  <p>This block of code works great when it's used in the example below.</p>
  
  <pre><code>zombieCreatures = creatures.filter(filterCreatures);
  </code></pre>
  
  <p>Unfortunately this block of code doesn't work when it's used in the same example.</p>
  
  <pre><code>zombieCreatures = creatures.filter(function(v) {
      filterCreatures(v);
  });
  </code></pre>
  
  <p>To me they look like identical instructions but obviously I am incorrect.  What is the difference?  Is it possible to make a callback function call another function inside of <code>.filter()</code>?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>'use strict';
  
  var creatures = [], zombieCreatures = [];
  
  var filterCreatures;
  
  creatures = [
    {species: 'Zombie', hitPoints: 90},
    {species: 'Orc', hitPoints: 40},
    {species: 'Skeleton', hitPoints: 15},
    {species: 'Zombie', hitPoints: 85}
  ];
   
  filterCreatures = function(v) {
    return v.species === 'Zombie';
  }
   
  zombieCreatures = creatures.filter(function(v) {
    filterCreatures(v);
  });
  
  console.log(zombieCreatures);</code></pre>
  </div>
  </div>
  </p>