Skip to content

JS的new做了什么

  1. 创建了临时对象/新对象
  2. 绑定原型
  3. 指定 this = 临时对象
  4. 执行构造函数
  5. 返回临时对象

参考链接:JS 的 new 到底是干什么的?