oh shit
【 在 blitz (blitz) 的大作中提到: 】
: 你这几个判断,我机器上的输出都是true啊,环境时node -v =>v6.1.0
: 测试代码:
: "use strict";
: function Base(name)
: {
: this.name=name
: }
: function Derived(name,age)
: {
: //Base.call(this,name);
: this.age=age
: }
: Derived.prototype=new Base("aaa")
this is not what is conventionally called "Derived is derived from Base",
so in practice never use this
if you have a very good reason to stack up prototype chain like this, at
least name the functions differently
: var d1=new Derived("name1",22);
: var d2=new Derived("name2",23);
: console.log("name" in d1)
: console.log("name" in d2)
: console.log("name" in Derived.prototype)
: console.log("name" in Object.getPrototypeOf(d1))
: console.log("name" in Object.getPrototypeOf(d2))
--
FROM 180.173.163.*