class声明函数
class Stuent {
constructor (name, age) {
this.name = name;
this.age = age;
}
detail () {
return this.name + '的年龄今年是'+ this.age + '岁';
}
}
let yeyu = new Stuent('哈哈', 18);
console.log(yeyu.detail());
原地址:https://www.cnblogs.com/zldream1106/archive/2013/05/21/3090340.html