标签:prot 过程 class 简洁 生成 lin str 构造函数 tab
- 新生成一个对象
- 链接到原型(继承该函数的原型)
- 绑定this(将原型中的属性和方法加入到this引用的对象中)
- 返回新对象
自己实现一个new:
1 | function create() { |
// 简洁版的new实现过程
1 | function newFunc(constructor){ |
原文:大专栏 new 的过程都干了什么
标签:prot 过程 class 简洁 生成 lin str 构造函数 tab
原文地址:https://www.cnblogs.com/wangziqiang123/p/11652412.html