mercredi 26 août 2020

Why is my variable not defined? Javascipt

I've already decreal a global variable in a function, but in the other function its says "variable not defined".

function myFunction1 {
  myFunction2();
  myFunction3();
}
funcion myFunction2() {
  computerChoice = "rock";
}

function myFunction3() {
  if (computerChoice == "rock") {
    console.log("rock");
  }
}

Aucun commentaire:

Enregistrer un commentaire