oojs: Using this Value

Using this value

In the previous article we saw how to access methods and properties of an object.
When you’re inside a method though, there is another way to access the object this method belongs to: by using the special value this.

var personObj={
        return this.name
personObj.sayHello(); // results in suresh

So when you say this, you are actually saying “this object” or “the current object”.


I Am suresh(suresh kumar )a Web developer,Freelancer,webdesigner,UI developer from bangalore. Got 6+ yrs of IT experience . I specialize in standards-based XHTML, CSS and JavaScript web development. Each site I develop is built to be search engine friendly (SEO), using the latest development principles and techniques.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *