Last active
August 29, 2015 14:20
-
-
Save pvamshi/9d76febc3f022f9a0b42 to your computer and use it in GitHub Desktop.
Value of 'this'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(this); | |
function printThis(){ | |
console.log("Inside printThis"); | |
console.log(this); | |
} | |
function printThisInClosure(){ | |
console.log("Insude PrintThisInClosure"); | |
console.log(this); | |
function inner(){ | |
console.log("Inside inner"); | |
console.log(this); | |
} | |
inner(); | |
} | |
printThis(); | |
printThisInClosure(); | |
var obj = {}; | |
obj.printObj = printThis; | |
obj.printInnerFunction = printThisInClosure; | |
obj.printObj(); | |
obj.printInnerFunction(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment