Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 1.65 KB

File metadata and controls

24 lines (15 loc) · 1.65 KB

F.prototype and constructor easy #javascript

by Pawan Kumar @jsartisan

Take the Challenge

What will be output of following code:

function User(name) {
  this.name = name;
}

let user1 = new User('John');

console.log(user1.name); // ?
console.log(user1.constructor === User); // ?

User.prototype = {}; 

let user2 = new user1.constructor('Pete');

console.log( user2.name ); // ?
console.log(user12constructor === User) // ?

Back Share your Solutions Check out Solutions