lundi 19 juillet 2021

Else If statement with numbers [duplicate]

My code does not seem to be working and I'm not sure why, I'm knew to else if statements so maybe I'm doing this completely wrong. I need the user to enter a number and depending on the number they enter a statement is printed out.

Please see my code below, the error message I'm getting is "Undefined" after the user enters the number and presses enter.

let waterPay = prompt("Please enter the amount of water you use to get a price you need to pay, thank you!");

if (waterPay > 6000) {
  console.log("The number is below 6000");
} else if (waterPay(6000 <= 10500)) {
  console.log("The number is between 6000 and 10500");
} else if (waterPay(10.5 <= 35000)) {
  console.log("The number is between 10500 and 35000");
} else(waterPay( <= 35000)) {
  console.log("The number is above 35000");
}

Aucun commentaire:

Enregistrer un commentaire