Skip to content

Instantly share code, notes, and snippets.

@kaneshin
Created October 4, 2011 23:43
Show Gist options
  • Save kaneshin/1263171 to your computer and use it in GitHub Desktop.
Save kaneshin/1263171 to your computer and use it in GitHub Desktop.
var foo = {
bar: 10,
baz: function(num, callback) {
callback(num * num);
},
qux: function(num, callback) {
var self = this;
this.baz(num, function(res) {
callback(res + self.bar);
});
}
};
foo.qux(5, function(res) {
console.log(res);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment