title: Difficulty understanding Javascript composing in this function
body: <p>Im following this course and came across this problem</p>
  
  <pre><code>const compose = (f, g) =&gt; (a) =&gt; f(g(a));
  const add1 = (num) =&gt; num + 1;
  const add5 = (num) =&gt; num + 5;
  compose(add1, add5)(10)
  </code></pre>
  
  <p>As i understand it <code>g(a)</code> gets run first so <code>num = 1</code> makes <code>1</code> for <code>g</code> and <code>10</code> for <code>a</code>, that makes it <code>f(1(10))</code>.
  But how does the <code>1</code> and the <code>10</code> know to add, why doesn't it multiply or minus ?</p>