1. Class 在语法上更加贴合面向对象的写法

2. Class在实现继承上更加易读、易理解

3. 更易于写java等后端语言

4.本质还是语法糖,使用prototype

 

 

Class语法

Class和普通构造函数的区别

typeof MathHandle // 'function'

MathHandle.prototype.construcroe === MathHandle  // 构造函数的显示原型有个construvtor等于它的构造函数本身

m.__proto__ === MathHandle.prototype // true  new时候,隐式原型等于显示原型

  

js构造函数

Class和普通构造函数的区别

 

Class和普通构造函数的区别

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-05
  • 2021-10-24
  • 2022-02-16
  • 2021-11-27
  • 2021-06-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-10
  • 2021-10-16
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案