Method invocation
suggest changeInvoking a function as a method of an object the value of this
will be that object.
var obj = {
name: "Foo",
print: function () {
console.log(this.name)
}
}
We can now invoke print as a method of obj. this
will be obj
obj.print();
This will thus log:
Foo
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents