Skip to content

Instantly share code, notes, and snippets.

@abhinavdhasmana
Created March 28, 2017 07:10
Show Gist options
  • Save abhinavdhasmana/d5e19fea6b0ce5abfc9be2889d040d50 to your computer and use it in GitHub Desktop.
Save abhinavdhasmana/d5e19fea6b0ce5abfc9be2889d040d50 to your computer and use it in GitHub Desktop.
'use strict';
function whoAmI() {
console.log('I am in local scope:', this);
function insideFunction() {
console.log('I am an inside function:', this);
}
insideFunction.apply(this);
}
this.myName = 'Abhinav';
whoAmI.apply(this);
// Output
// I am in local scope: { myName: 'Abhinav' }
// I am an inside function: { myName: 'Abhinav' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment