Mode entretien. Minuteur de 4 min, sans indices ni autocomplétion
Static method
FacileClasses4 min
Write a class Person. The constructor takes a first name and a last name. If they are not given, use 'John' and 'Doe'. The method sayFullName() returns the first and last name with a space between them.
Also add a static method greetExtraTerrestrials(raceName). It returns the string 'Welcome to Planet Earth ' with the race name at the end.
Exemples
new Person().sayFullName()Renvoie 'John Doe'
new Person('Jane', 'Smith').sayFullName()Renvoie 'Jane Smith'
Person.greetExtraTerrestrials('Martians')Renvoie 'Welcome to Planet Earth Martians'
Chargement de l'éditeur...
- Default name
- Name from the arguments
- The greeting is called on the class
Les tests cachés se lancent à la soumission