lundi 6 juillet 2015

Probem with javascript

Hello there i am writing a game and i have this problem: my if statements doesnt work at all so i decided to ask for help. here is the code that doesnt work:

if (jack==="yes") {
var compare= prompt ("1.mars,2.jupiter,3.moon") }
if (compare===2) {confirm ("your airplane crashed and you died")}
else if (compare===1) {confirm ("you arrived safely")}
else if (compare===3){
confirm("you survived an airplane crash but you need to escape")} 

P.S the last three if statements doesnt work i tried many things but nothing helped me.

Aucun commentaire:

Enregistrer un commentaire