3 ms·
Yeesh, it's a long article for a simple thing. They just let you control the implicit this arg to a function call. fn.call(t, x, y, ...) calls fn(x, y, ...) wi
by edflsafoiewq 5y ago
Yeesh, it's a long article for a simple thing. They just let you control the implicit this arg to a function call.
fn.call(t, x, y, ...) calls fn(x, y, ...) with t as this.
fn.apply(t, args) is fn.call(t, ...args).
fn.bind(t, x, y, ...) is (...args) => fn.call(t, x, y, ..., ...args).
- munchbunny 5y agoAgreed, this article takes a long time to explain the easy part and slides right past the hard part, which is the mess that is the this argument in general.