开发者社区 问答 正文

更改对象原型后,为什么 instanceof 运算结果是false?

function Rang(from, to){
    this.from = from;
    this.to = to;
}

Rang.prototype.include = function(x){
    return this.from < x && this.to > x;
}

var p1 = new Rang(3, 7);

Rang.prototype = {
    notInclude: function(){
        return this.from > x || this.to < x;
    }
}

console.log(p1 instanceof Rang);


//上述代码 为何最后控制台输入是false,求解释原因

展开
收起
a123456678 2016-03-12 14:43:30 2029 分享 版权
1 条回答
写回答
取消 提交回答
问答地址: