?
This document uses PHP Chinese website manual Release
JScript? | 語言參考 |
指當(dāng)前對象。
this.property
必選的 property 參數(shù)指的是對象的屬性。
this 關(guān)鍵字通常在對象的 構(gòu)造函數(shù)中使用,用來引用對象。
在下面示例中,this 指的是新創(chuàng)建的 Car 對象,并給三個屬性賦值。
function Car(color, make, model){
this.color = color;
this.make = make;
this.model = model;
}
對于 JScript 的客戶版本,如果在其他所有對象的上下文之外使用 this,則它指的是 window 對象。
版本 1
new 運(yùn)算符