+ 1
Problem with code
Hello I have been doing java script a while and I can't make the if ccommand work, if someone better than me is here tell me what I did wrong var answer = prompt("you have 2 gallons left how many miles do you go per gallon", "") <script> if (answer = 25) { document.write("We stopped at a gas station 24 miles away, you get there and recieve 5 gallons") }
8 Respuestas
+ 1
See? It works here. Looking at your code snippet now again maybe the problem is the location of your <script>
https://code.sololearn.com/WbDlwIa3Ynyp/?ref=app
+ 2
One thing I do know, I think the problem has something to do with line 6 (the one that says if answer = 25)
+ 1
if (answer == 25)... You probably mistyped it. Should be == not =
+ 1
Hum... Let me check something real quick
+ 1
There might be something else going on with the rest of the code because it works just fine when I put it in a Script on Code Playground
+ 1
k
+ 1
Please tell me what is on line 38 so I can know where to look 😀
0
cyk It still dosen't work.