可能我过于较真
function Student(name, age, sex) {
this.name = name
this.age = age
this.sex = sex
}
Student.sayHi = function () {
console.log('大家好 我是' + this.name)
}
Student.test = 'abc'
构造函数Student也是对象,为什么不能通过.sayHi直接添加方法呢?无论添加属性还是方法都添加不上
console.log('Student', Student);
Student ? Student(name, age, sex) {
this.name = name
this.age = age
this.sex = sex
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…