js class test(2)
by regepan
JavaScript
// ベースクラス
function A(){}
// サブクラス
function B(){}
// こいつを追加
B.prototype = new A();
// 検証
console.log(A.prototype);// A {}
console.log(B.prototype);// A {} になった!
by regepan
// ベースクラス
function A(){}
// サブクラス
function B(){}
// こいつを追加
B.prototype = new A();
// 検証
console.log(A.prototype);// A {}
console.log(B.prototype);// A {} になった!