lundi 20 février 2017

JS if statement not working with else statement

so i started making a game and i am trying to make an item to buy and i have a function but for some reason it skips over the code when everything that i want even though it shouldn't

function buyConsole(){
  if(money >= 400 && console === 1){
    console += 1
    money -= 400
  }else{
    if(console == 1){
      alert("you already have a console")
    }else{
      alert("not enought money and/or error A0000: function call error")
    }
  }
}

Aucun commentaire:

Enregistrer un commentaire