1

I came across this piece of code ... where args is interpreted to fn args object ... this is really confusing for me, and I couldn't get it

function memoize(fn) {
    return function(...args) {
        fn.apply(this, args);
    }
}

How does the inner function understand that args passed to it belongs to fn

Hend El-Sahli
  • 6,268
  • 2
  • 25
  • 42
  • https://stackoverflow.com/questions/4633125/is-it-possible-to-get-all-arguments-of-a-function-as-single-object-inside-that-f – CertainPerformance Mar 09 '21 at 18:23
  • @CertainPerformance from my understanding, accessing `arguments` inside the outer function should return `fn` arg .... bu tI want to get access to argments of `fn` – Hend El-Sahli Mar 09 '21 at 18:26

0 Answers0