Skip to content

Instantly share code, notes, and snippets.

@chochinlu
Created May 22, 2014 02:41
Show Gist options
  • Save chochinlu/3ff60eb15ae075a7d5d5 to your computer and use it in GitHub Desktop.
Save chochinlu/3ff60eb15ae075a7d5d5 to your computer and use it in GitHub Desktop.
js definitive guide 6th -- ch8.2.2
'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