function User(name){
        this.name=name;
    }
    function createByObject(obj,...args){
      const constructor=  Object.getPrototypeOf(obj).constructor;
      return new constructor(...args);
    }
    let hd=new User('HDR');
    let xj=createByObject(hd,'xj');
    xj.show();

 

posted on 2022-01-28 14:25  weakup  阅读(39)  评论(0)    收藏  举报