class Person {}
let agent = new Person(50);
console.log(agent);
We haven't defined a constructor
method on the Person
class nor does the Person class inherit (extend)
from an another class which has a constructor method.
CodePudding user response:
All classes in javascript have a default constructor method if the programmer does not define one. Try this in inspector:
class Person {}
console.log(Person);
and you'll be able to see the default constructor Javascript applies.