What's the output?
class Person {
constructor(name) {
this.name = name;
}
}
const member = new Person('John');
console.log(typeof member);You missed this one before
Classes are syntactical sugar for function constructors. The equivalent of the Person class as a function constructor would be:
function Person(name) {
this.name = name;
}
Calling a function constructor with new results in the creation of an instance of Person, typeof keyword returns "object" for an instance. typeof member returns "object".
Question 90 · see the original (opens in a new tab)
or press Enter