Skip to content

Instantly share code, notes, and snippets.

@cawel
Created March 13, 2018 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cawel/de088e9bb88557a8c5b992bcbfe8a401 to your computer and use it in GitHub Desktop.
Save cawel/de088e9bb88557a8c5b992bcbfe8a401 to your computer and use it in GitHub Desktop.
JavaScript Interview Question
var myObject = {
foo: "bar",
func: function() {
var self = this;
console.log("outer func: this.foo = " + this.foo);
console.log("outer func: self.foo = " + self.foo);
(function() {
console.log("inner func: this.foo = " + this.foo);
console.log("inner func: self.foo = " + self.foo);
}());
}
};
myObject.func();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment