Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

this Statement 

Refers to the current object.


this.property
property

Required. The identifier of a property of the current object.

The this keyword is typically used in object constructors to refer to the current object.

In the following example, this refers to the newly created Car object, and assigns values to three properties:

function Car(color, make, model){
   this.color = color;
   this.make = make;
   this.model = model;
}

For client versions of JScript, this refers to the window object if used outside of the context of any other object.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.