-2

I've been reading David Flanagan's 'JavaScript The Definitive Guide' and I have a question about the below code. What is each use of 'this' referring to?

function compose(f, g){
   return function(...args){
      return f.call(this, g.apply(this, args));
   };
}

const sum = (x, y) => x + y;
const square x => x * x;
compose(square, sum)(2, 3)    // => 25
Bryan
  • 9
  • 2

0 Answers0