Skip to content

Instantly share code, notes, and snippets.

@CaptainYarb
Last active August 29, 2015 13:56
Show Gist options
  • Save CaptainYarb/9258673 to your computer and use it in GitHub Desktop.
Save CaptainYarb/9258673 to your computer and use it in GitHub Desktop.
Scope question
var myVar = {bar:'foo'};
myVar.someClass = function(){
return {
foo: 'bar',
someFunction: function(){
console.log( this.foo ); // returns 'bar'
// can we get myVar.bar here?
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment