在这段代码中:
var Fruit = function() {}
Fruit.prototype = {
color: function () {
console.log('Fruit color...')
}
}
var Apple = function () {}
Apple.prototype = new Fruit()
Apple.prototype.constructor = Apple
var a = new Apple()
Apple.prototype = null // the question!!!
a.color()
Run Code Online (Sandbox Code Playgroud)
何时Apple.prototype设置为null,为什么实例a仍然可以调用该color方法?
javascript ×1