Hello,

I see different output for these 2 snippets of code. The only
difference between them is that a prototype is defined on one of them,
but not on the other.

// Snippet-1:
function Foo() { }
var f = new Foo;
console.log(f.constructor.name); // Prints "Foo"

// Snippet-2:
function Foo() { }
Foo.prototype = { };
var f = new Foo;
console.log(f.constructor.name); // Prints "Object"

Any idea why the behaviour changes by just adding a prototype?

Regards,
-Dhruv.




-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to