I've learned that in function invocation, this would refer to the global object. In the function below, which is the global object? Is it the Function or there's a single default global object where this would refer to? In addition to that, what does this code actually do? I am particularly confused about the method placeholder. Does it have to be replaced with a method that's pre-existing in Function.prototype? And in the line this.prototype[name] = func;, which property is it referring to, the method's or the Function.prototype's?
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};