WEB开发网
开发学院WEB开发Jsp this 语句 阅读

this 语句

 2008-01-05 19:02:54 来源:WEB开发网   
核心提示: 指当前对象, this.PRoperty必选的 property 参数指的是对象的属性,this 语句,说明this 要害字通常在对象的 构造函数中使用,用来引用对象, function Car(color, make, model){ this.color = color; this.make = make;

 

指当前对象。

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 运算符


Tags:this 语句

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接