Implement bind polyfill
Given the native bind is removed from Function.prototype.
bind()in JavaScript creates a new function with a fixedthisvalue and optionally preset arguments. It does not execute the function immediately; it returns a new function that will run later with the bound context. This is commonly used to ensure methods keep the correctthiswhen passed as callbacks.
You are required to implement myBind polyfill from scratch that replicates its behavior including partial application.
Example:
function multiply(a, b) {
return a * b;
}
const double = multiply.myBind(null, 2);
double(5); // 10
double(8); // 16