function Person(firstName = "John", lastName = 'Doe', age = 0, gender = 'Male') {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.gender = gender;
this.sayFullName = function() {
return this.firstName + " " + this.lastName
};
}
Person.prototype.greetExtraTerrestrials = function(raceName) {
return `Welcome to Planet Earth ${raceName}`;
};
このコードで何が問題になっていますか? greetExtraTerrestrials
というクラスメソッドを作成しませんか?クラスメソッドの作成
どうしたらうまくいかないのですか?エラーメッセージとは何ですか?問題文がなければ、すべてのコードは正しいです。 – Bergi