2016年9月

继承之构造函数(类)继承

 function A() {
    this.arr = [1,2];
}

A.prototype.showName = function () {
    console.log(this.arr);
}

function  B() {
   A.call(this);
}

var F = function(){};
F.prototype = A.prototype;
B.prototype = new F();
B.prototype.constructor = B;

var b = new B();
b.arr.push(4);
b.showName();

console.log(b.constructor)

var b2 = new B();
b2.showName();