1. function myNew (context) {
    2. // 1. 创建一个新对象
    3. const obj = new Object();
    4. // 2. 根据原型链, 设置空对象的 __proto__ 为构造函数的 prototype
    5. obj.__proto__ = context.prototype;
    6. // 执行构造函数, 将其 this 指向 新创建的对象(为这个对象添加属性)
    7. const res = context.apply(obj, [...arguments].slice(1));
    8. // 判断构造函数执行返回的结果, 原始值则忽略返回新创建的对象, 引用值则返回引用值.
    9. return typeof res === 'object' ? res : obj;
    10. }