Explicit this Binding in JavaScript

From the JavaScript cheat sheet · The "this" Keyword · verified Jul 2026

Explicit this Binding

Using call, apply, and bind

javascript
// call - invoke with specific this
func.call(thisArg, arg1, arg2);

// apply - invoke with array of args
func.apply(thisArg, [arg1, arg2]);

// bind - create bound function
const bound = func.bind(thisArg);
bound(arg1, arg2);
💡 call and apply invoke immediately, bind returns new function
⚡ Use call for known args, apply for array of args
📌 bind is commonly used to fix this in event handlers
🔥 Arrow functions are often simpler than bind for callbacks

More JavaScript tasks

Back to the full JavaScript cheat sheet