JingchaoZhao / js-learning

knowledge of webs
0 stars 0 forks source link

tips: 继承写法的区别 es5/es6 #10

Open JingchaoZhao opened 5 years ago

JingchaoZhao commented 5 years ago

ES6 Class一些特性:

  1. class 声明会提升,但不会初始化赋值。类似于let、const声明 会有暂时性死区;
  2. class声明内部会启用严格模式;
  3. class的所有方法(包括静态方法和实例方法)都是不可枚举的;
  4. class的所有方法都没有原型对象prototype,所以也没有[[construct]],不能使用new来调用;
  5. 必须使用new调用class; 6 class内部无法重写类名;
JingchaoZhao commented 5 years ago

image

image
JingchaoZhao commented 5 years ago
image
JingchaoZhao commented 5 years ago
image
JingchaoZhao commented 5 years ago
image