jeudi 10 décembre 2020

Some help me finish this code of array and if condition in JS. i am getting error of not defined yes

Help me complete this code it is a code that asks user the list of things you need to carry along with you while you are going on journey. for some reason i am getting multiple errors. i am getting an error of

Yes is not defined

and others help me out.

var readlineSync = require("readline-sync");
var carryitems = ["Passport", "Earphones", "Charger", "Mobile", "Identification", "Currency of that country","Basic medical kit"];
var userquestion = readlineSync.question("Do you want to the list of basic-items you need to carry during your flight journey : ");
for(i=0; i<7; i++){
  if(userquestion === yes){
    var itemquestion = ("Do you have" + carryitems[0+1]);
    if(itemquestion === yes){
      break;
    }
    else{
    console.log("Please consider carrying" + carryitems[0+i]);
    }
  }
  else{
    console.log("Thank you!, Happy journey");
  }
}

help me out solve the problem, thank you!

Aucun commentaire:

Enregistrer un commentaire