title: What's the significance of the "this" keyword in this nested function
body: <p>This function computes <code>f(g(...arg))</code> in JavaScript.</p>
  <pre><code>function compose(f,g){
     return function(...arg){
         return f.call(this, g.apply(this, args)};
     }
  }
  </code></pre>
  <p>I know that the first argument to the methods <code>call</code> and <code>apply</code> is the invocation context. However, I am not sure what's the significance of the <code>this</code> keyword in both <code>call</code> and <code>apply</code> methods above. It's clearer to me when the invocation context is an object like <code>{x:1}</code>, and then we use could use <code>this.x</code> to access the property <code>x</code>, but I am not clear on the use of <code>this</code> in the above context. Why do we use <code>this</code> like that in the above code?</p>
  <p>EDIT: the functions are called with these functions:</p>
  <pre><code>const sum = (x, y) =&gt; x + y;
  const square = x =&gt; x * x;
  compose(square, sum)(2, 3);
  </code></pre>