新しいオブジェクトが構築されると、オブジェクトは、コンストラクターのプロトタイプに明示的に設定されていないプロパティを委任するように設定されます。つまり、後でプロトタイプを変更しても、インスタンスの変更を引き続き確認できます。
最初:
function Foo(){}
foo=new Foo();
Foo.prototype={};
foo.constructor==Foo//true.why is this happening since construtor prototype is empty object
そのため、ステートメントは定義どおりに機能していません。正しいか間違っていますか? しかし、私がこれを行うと、結果は異なります
2番目:
function Foo(){}
Foo.prototype={};
foo=new Foo();
foo.constructor==Foo//false as aspected
再び3番目:
function Foo(){}
Foo.prototype={};
Foo.prototype.name="Maizere";
foo=new Foo();
foo.name==Maizere//true.The definition at the top is applying here,if so why the definition not working in the first: example
簡単な英語を手伝ってください.imは本当に頭が痛いです。