Whenever I perform the following code:
function foo(){//some stuff..}
var bar = foo;
Am I actually copying the function defined as foo
to bar
?
Is there a method to assign a function to a variable in a way that it points to the function instead of making a copy? This means having multiple variables assigned to the same function, and whenever this function is updated, all assigned variables will be automatically updated as well.
I'm aware of achieving this using prototype inheritance but my specific question is whether it can be done simply by assigning variables?