Loading challenge...
Preparing the challenge details...
Loading challenge...
Preparing the challenge details...
Implement Function.prototype.bind from scratch, including partial application and the new-operator edge case that almost nobody gets right.
bind is the hardest of the three function prototype methods. It returns a new function with this permanently fixed — but that binding must be ignored if the bound function is later called with new. The new instance must become this, and the prototype chain must still work so instanceof checks pass.
Goal: Implement myBind with partial application. Bonus: handle the `new` operator case.
Continue learning with these related challenges
Implement Function.prototype.call from scratch using the temporary-property trick and a Symbol key to avoid collisions.
Implement Function.prototype.apply from scratch — identical to call except arguments arrive as a single array.
Implement a Function.prototype.call polyfill from scratch. Master JavaScript this binding, execution context, primitive boxing, and safe property assignment techniques.
Implement Function.prototype.call from scratch using the temporary-property trick and a Symbol key to avoid collisions.
Implement Function.prototype.apply from scratch — identical to call except arguments arrive as a single array.
Implement a Function.prototype.call polyfill from scratch. Master JavaScript this binding, execution context, primitive boxing, and safe property assignment techniques.