Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 1.7 KB

File metadata and controls

25 lines (18 loc) · 1.7 KB

Class and Prototype easy #javascript

by Pawan Kumar @jsartisan

Take the Challenge

What will be output of following code:

class User {
  constructor(name) {
    this.name = name;
  }

  greet() {
    console.log(`Hello ${this.name}`);
  }
}

console.log(typeof User);
console.log(User.prototype);
console.log(User.prototype.constructor);
console.log(Object.getOwnPropertyNames(User.prototype));

This challenge tests your knowledge about how "class" syntax actually do under the hood.


Back Share your Solutions Check out Solutions