0
我明確地定義剛剛創建的對象的constructor屬性如下所示:應用構造屬性沒有結果
var fooProto={foo:"prototype"};
function f(){ };
f.prototype=fooProto;
var object= new f();
object.constructor.prototype.bar="bar";
console.log(object.foo, Object.prototype.bar);
在我們prototype,bar
控制檯,但我明確undefined,undifined
。請解釋爲什麼發生?
我不明白這個問題的構造。 *「但我是明確的未定義的,未定義的。」*是什麼意思? –
我認爲你的意思是我'期待' – HMR