| 「这是我参与11月更文挑战的第3天,活动详情查看:2021最后一次更文挑战」 |
|---|
工作中常用到的构造函数、继承、promise、class,一文带你了解清楚。废话不多说,直接来干货。
构造函数 VS Class
typeof MathHandle // 'function'
// 函数显式原型 prototype
MathHandle.prototype.constructor === MathHandle // true
// new出的实例隐式原型 __protp__
m.__proto__ === MathHandle.prototype // true
typeof MathHandle // 'function'
// 函数显式原型 prototype
MathHandle.prototype.constructor === MathHandle // true
// new出的实例隐式原型 __protp__
m.__proto__ === MathHandle.prototype // true
继承
promise
es6重用功能
- let/const
- 多行字符串/模板变量
- 解构赋值
- 块级作用域
- 函数默认参数
- 箭头函数