Method invocation

suggest change

Invoking 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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents