js new 的原理

function mynew(fn) {

  return function() {

    let obj = {

      __proto__:fn.prototype

    }

    fn.apply(obj,arguments)

    return obj

  }

}

原文地址:https://www.cnblogs.com/liuhp/p/12218737.html