Good I am the following code that I have taken it from this page this particular example:
var myApp = function(){
var that = this;
var name = "World";
var sayHello = function(){
console.log( 'Hello, ' + that.name );
};
sayHello();
};
myApp();
It is assumed that when I call the function this
refers to the object itself so when saving in the variable that
, the value of the object is saved and then in console that
has access to name
, but when I debug this
keeps pointing to the object window
. If someone can tell me what happens and why. I would appreciate it.