当继承的类new的时候会调用父类的constructor,在父类的constructor里做个判断 if(new.target!==父类名){alert();} ,当继承的子类new的时候就会alert()一次
当继承的类new的时候会调用父类的constructor,在父类的constructor里做个判断 if(new.target!==父类名){alert();} ,当继承的子类new的时候就会alert()一次