Why does obj.constuctor.name give 2 different results if prototype is missing? How do i get the constructor name instead of "Object" if it has prototype then?
// Class with prototype
function Foo(a) {
this.a = a;
}
Foo.prototype = {
bar: function () {
console.log(this.a);
}
};
f=new Foo(1)
f.constructor.name
"Object"
// Class with no prototype
function Fooee(a) {
this.a = a;
}
f1=new Fooee(1)
f1.constructor.name
"Fooee"