假设有以下实例:
var A = function(name){
this.name = name;
}
var B = function(age){
this.age = age;
A.apply(this,new Array());
}
// B.prototype = new A();
var b = new B(20);
if(b instanceof B){
alert("true");
}
if(b instanceof A){
alert("true");
}
如果我要alert出两个true ,那么只需要把注释的部分打开。 可是这种情况会B new 出来的每个对象都instanceof A, 如果我只要让某些B的实例instanceof A,还可让某些B 的实例instanceof A 返回false,这个要怎么办,我觉得自己没思路,求助!!