Created
May 16, 2017 09:28
-
-
Save tkssharma/6a1fcca1787e90e97c300fd84686a71a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// call functionality | |
var bar = 80; | |
function foo(){ | |
console.log(this.bar); | |
} | |
var obj = {'bar' : 10}; | |
var obj2 = {'bar' : 20}; | |
foo.call(obj2); | |
// dynamic binding | |
var bar = 80; | |
function foo(){ | |
var bar = 90; | |
bazz(); | |
} | |
function bazz(){ | |
console.log(this.bar) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment