class Student{
constructor(name,roll){
this.name = name
this.roll = roll
}
intro(){
console.log('name is',this.name,' and roll number is',this.roll)
}
}
Student.prototype.introduce = ()=> console.log('name is',this.name,' and roll number is',this.roll)
let s1 = new Student('any name',12345)
s1.intro()
s1.introduce()
问题是,介绍和介绍都已正确加载到Student.prototype中,但是介绍方法是打印出名称和名称,但是介绍在两个地方都给出了未定义的内容
任何帮助表示赞赏。谢谢!