1
我只希望在創建類和使用類方法後調用構造函數。我怎麼能在JavaScript中做到這一點?謝謝!如何在javascript中創建類後運行函數
var Test=function(){
//hello(); // why not working? How call?
}
Test.prototype.hello=function(){
console.log(1);
}
var t=new Test();
t.hello()
https://jsfiddle.net/dmitriykupriynov/doo6bj0b/
你是不是已經在做了? – adeneo
只是做'this.hello()' – Ramanlfc