Déclarant une méthode interne d'une classe
/*sayName() is an internal method, you cannot use sayName with an instance of Person but you CAN use yellName*/
class Person{
constructor(name)
{
this.name = name;
this.sayName();
this.yellName = function()
{console.log(this.name);
}
}
sayName()
{
console.log(this.name)
}
}
Javasper