Created
March 28, 2017 07:12
-
-
Save abhinavdhasmana/0b18d32035e58d055caee576f5c8e79d to your computer and use it in GitHub Desktop.
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
'use strict'; | |
function whoAmI() { | |
console.log('I am in local scope:', this); | |
this.insideFunction = function () { | |
console.log('I am an inside function:', this); | |
} | |
this.insideFunction(); | |
} | |
this.myName = 'Abhinav'; | |
whoAmI.apply(this); | |
// Output | |
// I am in local scope: { myName: 'Abhinav' } | |
// I am an inside function: { myName: 'Abhinav', insideFunction: [Function] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment