这有什么区别...
function Person(name, age, sex) {
this.name = name;
this.age = age;
this.sex = sex;
}
和这个...
function Person(name) {
this.name = name;
this.age = age;
this.sex = sex;
}
和这个...
function Person() {
this.name = name;
this.age = age;
this.sex = sex;
}
谢谢!
大卫,我有一段我正在构建的游戏的代码,看起来像这样......
function Player(node){
this.node = node;
this.grace = false;
this.replay = 3;
this.shield = 3;
this.respawnTime = -1;
...
return true;
}
并且它不会返回参考错误。它是我正在构建的 javascript 游戏中玩家的对象...