mardi 5 juillet 2016

Repel ifElse statement

I consider myself a novice on Javascript language, and i have a problem with my code. I am trying to simulate a simple if else statement, that relates to if your repel runs out, the program will ask you to use another one. However when i try to run it on Chrome, nothing is printed out on the screen.

Here is my code:

<html>
<head>
</head>

<body> 
<script type = "javascript/text"> 

var repelsInBag = 10; 

  if (repelsInBag > 1){
    document.write("Would you like to use another repel?");
  }else{
    document.write("Repel effect has ran out");
  }
</script>

</body>

</html>  

Thanks in advance !

  • Stephen

Aucun commentaire:

Enregistrer un commentaire