function Thing(name) {
this.name = name;
}
Thing.prototype.doSomething = function(callback) {
callback.call(this);
}
function foo() {
alert(this.name);
}
var t = new Thing('Joe');
t.doSomething(foo); // Alerts "Joe" via `foo`
Created
October 16, 2019 15:15
-
-
Save oviniciusfeitosa/546a951d4faa9e4d9fb796e031afe969 to your computer and use it in GitHub Desktop.
Javascript execute callback.md
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment