19.Class的基本语法

 

 

1.简介

JavaScript 语言中,生成实例对象的传统方法是通过构造函数。

function Point(x, y) {
  this.x = x;
  this.y = y;
}

Point.prototype.toString = function () {
  return '(' + this.x + ', ' + this.y + ')';
};

var p = new Point(1, 2);

 

 

2.严格模式

 

3.constructor方法

 

4.类的实例对象

 

5.class表达式

 

6.不存在变量提升

 

7.私有方法

 

8.私有属性

 

9.this的指向

 

10.name属性

 

11.Class的取值函数(getter)和存值函数(setter)

 

12.Class的Generator方法

 

13.Class的静态方法

 

14.Class的静态属性和实例属性

 

15.new.target属性

 

posted @ 2017-06-19 17:53  泠风lj  阅读(158)  评论(0编辑  收藏  举报