Sunday, December 2, 2018

How does 'this' works in javascript?

hi i am a little confusion on how exactly this works in javascript.Based on this example:




var myFunction = function(){
function testMe(){
console.log(this) --------> DOMwindow
}
console.log(this) ---------> myFunction
}

var myvariable = new myFunction();



What is happening here?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...