I want to understand the following behaviour because the explanation on this site javascript garden is not enough for me.
It would be much appreciated if you could give me a clear explanation about the questions which are in the inline comments.
Here the example:
function Foo() {}
Foo.prototype.method = function(a, b, c) {
console.log(this, a, b, c);
};
Foo.method = function() {
Function.call.apply(Foo.prototype.method, arguments);
};
Foo.prototype.method(1,2,3) // Foo { method=function()} 1 2 3 //this output is obvious
Foo.method(1,2,3) // Number {} 2 3 undefined // I want understand why the first argument is a number and the last one is undefined