apply fn vs invoke fn

Edit on GitHub

apply vs invoke

Setup

function myFoo(a, b, c) {
  return a + b + ;
}

Tests

  • apply fn

    myFoo.apply(null, [1, 2, 3]);
  • invoke fn

    myFoo(1, 2, 3);