Думаю, проблема где-то в отступах и else'ах.
Вот этот вариант работает:
var ATM = {
is_auth: false,
current_user: false,
cash: 1000,
users:[
{number: "0025", pin: "132", debet: 675, group: "user"},
{number: "0001", pin: "000", debet: 1000000, group: "user"},
{number: "1111", pin: "111", debet: 0, group: "admin"}
],
getcash: function(amount) {
if (this.is_auth) {
if(amount > 0 && amount <= this.cash && this.users[this.current_user].debet >= amount){
this.cash -= amount;
this.users[this.current_user].debet -= amount;
return amount;
} else {
return "no money";
}
} else {
return "go auth";
}
},
auth: function(number, pin){
for (i=0; i < this.users.length; i++) {
if (this.users[i].number == number && this.users[i].pin == pin) {
this.is_auth = true;
this.current_user = i;
break;
}
}
},
loadcash: function (bablo) {
if (this.is_auth) {
if (bablo > 0 && this.users[i].number == number && this.users[i].pin == pin && this.users[i].group == "admin") {
this.cash = this.cash + bablo;
} else {
return "you are not admin";
}
} else {
return "go auth";
}
}
};