Created
May 22, 2014 02:41
-
-
Save chochinlu/3ff60eb15ae075a7d5d5 to your computer and use it in GitHub Desktop.
js definitive guide 6th -- ch8.2.2
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'; | |
var o = { | |
m: function(){ | |
var self = this; //save this value in a variable | |
console.log(this === o); //true | |
f(); | |
function f(){ | |
console.log(this === o); //false | |
console.log(this); //undefined | |
console.log(self === o); //true | |
} | |
} | |
}; | |
o.m(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment