My question is pretty straight forward, but I can't find an answer anywhere (maybe my search terminology isn't correct, but here goes)...
Why is it that I can do the following:
var _Class = function(){
this.output = "Hello";
}
var Class = new _Class();
Class.Talk = function(){
console.log(this.output);
}
Class.Talk(); // outputs "Hello"
And this:
var func = function(){
console.log(Class.output);
}
func(); // outputs "Hello"
However I can't do:
var _Class = function(){
this.output = "Hello";
}
var Class = new _Class();
Class.Talk = function(){
console.log(this.output);
}
var func = Class.Talk;
func(); // undefined
I thought that this is meant to store a reference to the original function?