When I write
function abc() {
return 3;
}
var t = new abc();
console.log(t); // abc {}
However when i do this
function a() {
this.name = 'test';
}
function b() {
this.age = 33;
return new a();
}
var p = new b();
console.log(p); // a { name = 'test'}
So In first example, why does it return an object when return is actually returning a number. And when i do return new Func() .... i get the new Obj.. the returned value.
In one scenario i get returned value, in other the main obj.