【发布时间】:2023-03-25 04:54:01
【问题描述】:
这是我的课
var Player = function (name) {
this.init(name);
}
$.extend(Player.prototype, {
Name: '',
Goals: 0,
Fouls: 0,
Holding: 0,
Games: 0,
Wins: 0,
Taken: 0,
init: function(name){
this.Name = name;
this.Goals= 0;
this.Fouls= 0;
this.Holding= 0;
this.Games= 0;
this.Wins= 0;
this.Taken= 0;
},
setGoal: function (num) {
this.Goals+= num;
},
setFouls: function (num) {
this.Fouls+=num;
},
setHolding: function (holding) {
this.Holding = (this.Holding * (this.Games-1) + holding) / (this.Games);
},
setGames: function () {
this.Games+=1;
},
setWins: function () {
this.Wins+=1;
},
setTaken: function (num) {
this.Taken+=num;
}
});
我尝试了很多东西,但是每次我在创建此类的实例后尝试访问一个方法时,它都会中断并且不要让我继续。
【问题讨论】:
标签: javascript jquery class object jquery-mobile