why instanceof keeps saying true after prototype changed?
问题 The instanceof operator should look at the prototype, no? Why does it not change its answer after the object's prototype has been changed? Example below: // The .prototype of objects created with 'new MyKlass' // is MyKlass.prototype var MyKlass = function(name, age) { this.name = name; this.age = age; } var xx = new MyKlass('xx', 20); console.log(xx instanceof MyKlass); // true, OK xx.prototype = new String('s'); console.log(xx instanceof MyKlass); // also true, WHY??? 回答1: This case is