JavaScript constructor test in Google Chrome Dev console

enter image description here

I’m trying to create an object in javascript using the constructor function form inside Google Chrome dev console.

v1 = new V("Prabhas", 27);

When I type this, why does it return V {name:”Prabhas”, age:27} – I know that’s the object that’s getting created – but why does it not say:

v1{name:"Prabhas", age:27} 

This is also the case when I explicitly ask for object

v1 {The highlighted line} 

Why does it not say:

v1{name:"Prabhas", age:27}

Any pointers would be helpful.
Thanks


Source: oop

Leave a Reply