I would like to understand the relation between Function and function in javascript.
Let me make an example:
Function.prototype.bind // function () { [native code] }
var foo = function () {};
foo.bind; //function () { [native code] }
My question is
Function.prototype.bind and foo.bind refers to the same code?
If yes, can someone explain me the relation?
Maybe you, just like me some weeks ago, are wondering about the difference between adding a function to this (inside the outer function) and adding it via the prototype keyword. The key difference is, that the later is only added once to the prototype object, while the first (where you assign the new function to this and return this) is added every time you make a new instance of your function(object).
I found this post really good: Use of 'prototype' vs. 'this' in JavaScript?