vendredi 6 novembre 2015

Assigning IF statement outcome to a variable - JavaScript

Is it possible to assign the outcome of an IF statement to a variable in JS?

  if (busNumber[currentBus][2] == route[0]){
     console.log("Correct!");
  }
  else {
     console.log("Incorrect!");
  } 

Is it possible to assign Correct or Incorrect to a variable so i can thereafter call it in other areas of the program?

Aucun commentaire:

Enregistrer un commentaire