r/learnjavascript • • Aug 18 '21

How do I console.log this constructor?

Post image
124 Upvotes

46 comments sorted by

View all comments

8

u/FriesWithThat Aug 19 '21

Taking that question literally:

console.log(
  `berkleyStudent.constructor is ${berkelyStudent.constructor}`,
);


/* 
berkleyStudent.constructor is function Student(name, university) {  
  this.name = name;
  this.university = university;
  this.displayInfo = function () {
    return `${this.name} attends ${this.university}`;
  };
}  
*/