在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ es6 Reflect.construct方法不執(zhí)行class的construc

es6 Reflect.construct方法不執(zhí)行class的constructor?

class Test{
        consturctor(con){
            console.log(1);
            this.con=con;
        }
        show(){
            console.log(this.con);
        }
    }
    const t=Reflect.construct(Test,['test']);
    t.show();
    function Test2(con){
        console.log(2);
        this.con=con;
    }
    Test2.prototype.show=function(){
        console.log(this.con);
    }
    const t2=Reflect.construct(Test2,['test']);
    t2.show();

Reflect.construct并沒有執(zhí)行class的constructor導(dǎo)致this.con為undefined,但function定義的是可以的,是bug?

回答
編輯回答
伐木累

有點坑啊你。不是bug,構(gòu)造函數(shù)名稱拼錯了。

**consturctor --> constructor**
2017年2月9日 07:04