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