Help


#1

this is my code

confirm("In this game you will follow the directions in the text box shown")
prompt("To start the game type continue the click ok")
if("continue")
prompt("An arrow is flying out of the sky at you. What will you do. Type the number of the move you want to do then press ok. --------------------------------------------------------------I: Use shield II:Try to hit with sword III:Try to run")
if("I.length = 1")
confirm("the arrow hit you in that back")

if("II.length > 1")
confirm("your sword slipped and the arrow hit you")

if("III.lenght > 2")
prompt("the arrow hit your shield and you survived. type and click ok")

When the text boxes come up and i type in III the answer for the first option will come up


#2

"I.length = 1" is a string

strings are evaluated to true, your condition is never evaluated

also, a single equal sign means assign in JS


#3

i also did if("1") and it didn't work


#4

You need to check if the length of I is equal to 1. Doing if("1") does not return a boolean other than true.


#5

so do you know any things i could do to have options like this


#6

if you want to do a comparison, don't put quotation marks around it, this will simply make it a string


#8