mercredi 9 décembre 2020

how to check in if condition if the the word entered by the user is present in the array assigned to a variable

please refer to line 2 after comment. this issue is mentioned in the code in comments.

//valid input to be taken by user
var validanswerone = ["yes" , "YES", "Yes"];//here i want to take multiple form of input the user might type but my efforts are going effort less.
var validanswertwo = "no";//only this is working.

//conditions
if (userage === validanswerone){
  console.log("\n\nPlease put your credit card details in the next page" + ", you will be redirected soon!");
}
else if(userage === validanswertwo){
  console.log("\n\nWe are sorry!");
  console.log("\n\nPlease try back in" + "  *days remaining to be become 18+ will be added in the coming update still not understood the formula to implicate it*");
}
else{
  console.log("\n\nInvalid input!")
}

Aucun commentaire:

Enregistrer un commentaire