title: How to understand what is happening with this higher order function closure
body: <p>I know my code below is wrong but there is clearly some bit of information I am missing. I have to write much more complex higher order functions but if I do not truly understand simple ones I have no chance.</p>
  
  <p>hof.add should return the total of the two arguments passed. Very simple... 
  But given I am to create this higher order function is must use closure.</p>
  
  <pre class="lang-js prettyprint-override"><code>
      hof.add = function(add) {
        function makeAdd(a, b) {
          return add(a + b);
        }
        return makeAdd;
      };
  
  </code></pre>
  
  <pre><code>it('returns total of the two arguments', () =&gt; {
          expect(hof.add(56, 5)).to.be.equal(56 + 5);
          expect(hof.add(91, -71)).to.be.equal(91 + -71);
        });
  </code></pre>
  
  <p>(framework given to build on top of)</p>
  
  <pre><code>hof.add = function() { };
  </code></pre>