関数呼び出し()を呼び出すことと継承したクラスの暗黙のコンストラクタを呼び出すことの違いは何ですか?call()関数と継承クラスの暗黙のコンストラクタの呼び出し
例1:
function DepthRectangle(w, h, d){
Rectangle.call(this, w, h);
this.depth = d;
}
例2:
はfunction DepthRectangle(w, h, d){
this = new Rectangle(w, h);
this.depth = d;
}
Rectangleのコンストラクタ:
function Rectangle(w, h){
this.width = w;
this.height = h;
}
私の意見では、このサイトはFacebookを殺すでしょう。 :D –