Skip to content

Latest commit

 

History

History
12 lines (6 loc) · 282 Bytes

File metadata and controls

12 lines (6 loc) · 282 Bytes

解题思路 or 实现原理

new关键字做了哪些事?

  • 创建一个 新对象

  • 将构造函数的作用域赋值给这个新对象 -> this 指向这个 新对象

  • 执行构造函数中的代码 -> 为 新对象 添加属性

  • 返回 新对象