Method extraction gotchas, partial application
Fix method extraction with call/apply/bind and learn tiny partial application patterns with bind and wrapper arrows.
Big picture
Goal: Keep this stable after extraction and pre-fill args.
- call(thisArg, a, b)
- apply(thisArg, [a, b])
- bind(thisArg, a) → returns new function
- Partial application with bind or a tiny arrow

Extraction gotcha
Calling as obj.method() works, but extracting the function loses the object and breaks this.
// Extraction loses this
const user = {
name: "Ayla",
label: function (prefix) {
return prefix + ":" + this.name;
}
};
console.log("method call:", user.label("Hi")); // "Hi:Ayla"
// Extract
const f = user.label;
console.log("extracted:", f("Hi")); // this is missing -> "Hi:undefined" (in strict mode this is undefined)

All lessons in this course
- Lexical vs dynamic this, arrows revisited
- Method extraction gotchas, partial application
- Functional alternatives — pass context, closures, tiny helpers