Loading problem…
Implement your own version of Function.prototype.bind method. The bind method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
thisArg parameter to be used as the this valuenull or undefined as thisArg (should default to global object)new operator on bound functions (constructor calls)length)function greet(greeting, punctuation) {
return `${greeting}, ${this.name}${punctuation}`;
}
const person = { name: 'Alice' };
// Using built-in bind
const boundGreet = greet.bind(person, 'Hello');
boundGreet('!'); // "Hello, Alice!"
// Using your implementation
const myBoundGreet = greet.myBind(person, 'Hello');
myBoundGreet('!'); // "Hello, Alice!"