Modo entrevista. Cronômetro de 4 min, sem dicas e sem autocompletar
Static method
FácilClasses4 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.
Exemplos
new Person().sayFullName()Retorna 'John Doe'
new Person('Jane', 'Smith').sayFullName()Retorna 'Jane Smith'
Person.greetExtraTerrestrials('Martians')Retorna 'Welcome to Planet Earth Martians'
Carregando o editor...
- Default name
- Name from the arguments
- The greeting is called on the class
Os testes ocultos rodam no envio