function objectFactory(){ const obj= new Ojbect() const Constructor = [].shift.apply(arguments) obj.__proto__ = Constructor.prototype const ret= Constructor.apply(obj,arguments) return typeof ret === 'object' ? ret : obj } function _new(fn, ...args){ let obj = Object.create(fn.prototype) fn.apply(obj,args) const ret= Constructor.apply(obj,arguments) return typeof ret === 'object' ? ret : obj }