js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Solve 'Fun with ES6 Classes #1 - People, people, people' #269

Closed odv closed 5 years ago

odv commented 5 years ago

https://www.codewars.com/kata/fun-with-es6-classes-number-1-people-people-people/train/javascript

RazvanBugoi commented 5 years ago
class Person {
  constructor(firstName = "John", lastName = "Doe", age = 0, gender = "Male") {
    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;
    this.gender = gender;
  }

  sayFullName() {
    return `${this.firstName} ${this.lastName}`;
  }

  static greetExtraTerrestrials(raceName) {
    return `Welcome to Planet Earth ${raceName}`}
}