Ejecución del código cuando se crea la instancia
class Person
{
constructor(firstName, lastName)
{
this.firstName = firstName;
this.lastName = lastName;
console.log(this.firstName);
console.log(this.lastName);
}
}
const test=()=>
{
let p = new Person("John", "Smith");
}
/*include code you want executing every time an instance is created in the constructor()*/
Javasper