when the new object is constructed ,The object is set up to delegate any properties which haven't been explicitly set up to its constructor's prototype. That means that we can change the prototype later, and still see the changes in the instance.
first:
function Foo(){}
foo=new Foo();
Foo.prototype={};
foo.constructor==Foo//true.why is this happening since construtor prototype is empty object
so the statement are not working as per the definition.right or wrong? but if i do this than result is different
second:
function Foo(){}
Foo.prototype={};
foo=new Foo();
foo.constructor==Foo//false as aspected
again third:
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
plz help with simple english.i m really getting headache.
constructor, couldn't you just usefoo instanceof Foo?instanceofwould be ideal for. Unless I'm overlooking something.instanceofwas what you were looking for in case you're trying to solve an issue. In case this is more of a theoretical question about how theconstructorproperty behaves, then these are unrelated.