In this case prototype object doesn't have constructor property anymore. Here is just an empty object. But, despite this, somehow new obj.constructor still creates an empty object. How?
function Constructor() {
this.name = 'Kira';
this.age = 35;
this.city = 'New-York';
};
Constructor.prototype = {};
let obj = new Constructor;
let obj2 = new obj.constructor;
console.log(obj2); //{}
And here object is also created. In the console of Chrome browser, it's displayed as a String.
function User(name) {
this.name = name;
}
User.prototype = {};
let user = new User('John');
let user2 = new user.constructor('Pete');
console.log(user2);
How can it be? How are objects created here?
