this 语句
指当前对象。 this .property 必选的 property 参数指的是对象的属性。 说明 this 要害字通常在对象的 构造函数 中使用,用来引用对象。 示例 在下面示例中, this 指的是新创建的 Car 对象,
指当前对象。
this.property
必选的 property 参数指的是对象的属性。
说明
this 要害字通常在对象的 构造函数中使用,用来引用对象。
示例
在下面示例中,this 指的是新创建的 Car 对象,并给三个属性赋值。
function Car(color, make, model){
this.color = color;
this.make = make;
this.model = model;
}
对于 JScript 的客户版本,假如在其他所有对象的上下文之外使用 this,则它指的是 window 对象。
要求
版本 1
请参阅
new 运算符
精彩图集
精彩文章