Skip to content

Instantly share code, notes, and snippets.

@PavanKu
Created December 26, 2017 05:48
Show Gist options
  • Save PavanKu/8da517cf52c90c04491e5f88bde6b665 to your computer and use it in GitHub Desktop.
Save PavanKu/8da517cf52c90c04491e5f88bde6b665 to your computer and use it in GitHub Desktop.
Example for this
function multiply(p, q, callback) {
callback(p * q);
}
let user = {
a: 2,
b:3,
findMultiply: function() {
multiply(this.a, this.b, function(total) {
console.log(total);
console.log(this === window);
})
}
}
user.findMultiply();
//Prints 6
//Prints true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment