我使用 webstorm 10,并使用以下代码尝试 ecmascript 6:
/**
* Class Person
*/
class Person {
/**
* Constructor
* @param lastname
* @param firstname
* @param age
* @param sexe
*/
constructor(lastname, firstname, age, sexe) {
this.lastname = lastname;
this.firstname = firstname;
this.age = age;
this.sexe = sexe;
}
/**
* Return the name as string
* @returns {string}
*/
toString() {
return this.firstname + ' ' + this.lastname;
}
/**
* Return true if is an Adult
* @returns {boolean}
*/
isAdult() {
return this.age > 18;
}
/**
*
* @param {Person} person
* @returns {*}
*/
static isAdult(person) {
return person.isAdult();
}
}
我做错了什么webstorm告诉我toString中的名字和姓氏是未解决的变量,所以年龄以及静态方法中的isAdult()?