首页 > 学院 > 开发设计 > 正文

this 语句

2019-11-18 11:08:27
字体:
来源:转载
供稿:网友

 

指当前对象。

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



上一篇:with 语句

下一篇:throw 语句

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表