Показать сообщение отдельно
  #1 (permalink)  
Старый 12.11.2013, 23:10
Новичок на форуме
Отправить личное сообщение для Iceman90 Посмотреть профиль Найти все сообщения от Iceman90
 
Регистрация: 12.11.2013
Сообщений: 2

Uncaught SyntaxError: Unexpected identifier
Я извиняюсь, если вопрос тупой, я только учу JS. Вот программка Банкомат и в 32 строке в консольке выдаёт Uncaught SyntaxError: Unexpected identifier...




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";
		}
	},
			
		
	} 
	
};
Ответить с цитированием