function Human(name, currentMail, currentScore, newScore) {
this.name = name;
this.currentMail = currentMail;
this.currentScore = currentScore;
this.newScore = newScore;
this.changeScore = function (ns) {
if (ns != "") {
console.log(ns + "Is Your New Score");
this.currentScore = ns;
}
};
this.changeMail = function (cmail) {
if (cmail != this.currentMail) {
console.log(cmail + "Is Your New Mail");
currrentMail = cmail
};
};
}
var ilan = new Human();
ilan = {
name: "Ilan Vachtel",
currentMail: "[email protected]",
currentScore: "85"
};
console.log(ilan);
ilan.newScore = "89";
ilan.changeScore("45");
console.log(ilan);
此代码运行我这个错误我不明白我做错了什么,请帮忙吗? 它的一个开始,但是,不能明白为什么它不工作 感谢提前未捕获TypeError:undefined不是功能匿名函数
不要再将其初始化为JavaScript对象。删除此行'ilan = {name:“Ilan Vachtel”,currentMail:“[email protected]”,currentScore:“85”}; ' – andrex 2014-09-19 22:17:29
@Ilan,在写问题时请花一些时间,让其他人花更少的时间帮助你。这次我会进行格式化,但下次要由您决定。 – Miki 2014-09-19 22:21:32
Isthiscommenteasilyilyreadable?No?Thenyoumightconsiderspacesinyourcode,at leastastwhenaskingotherforhelp。 – 2014-09-19 22:21:45