1. window.news = function(){
    2. const [instance, ...arg] = arguments;
    3. let _o = Object.create(instance.prototype);
    4. let result = instance.apply(_o, arg);
    5. return typeof result === 'object' ? result : _o;
    6. }
    7. function Test(name){
    8. this.name = name;
    9. }
    10. Test.prototype.getName = function(){
    11. console.log(this.name)
    12. }
    13. let o = news(Test,'张三')
    14. console.log(o)
    15. o.getName()