下面的代码应该打印出字符串,sname
但它没有这样做。根本不抛出任何错误?
var Student = function(name, fee) {
if(fee >= 1000) {
this.registered = new Boolean(true);
} else {
this.registered = 'not rgistered yet';
}
}
Student.prototype.isRegistered = function() {
return this.registered;
}
var John = new Student('John', 1000);
if(John.isRegistered() === true) {
$('#sname').text('John is now a registered student');
}