+ 1

Can someone try to fix these Javascript errors

Hello I made a few bugs in this coding and I know what it is I would just like to see if anyone would know how to fix it. https://code.sololearn.com/WsLx5KvfA1Sh/#html

17th Apr 2018, 2:13 AM
Supergrupgr
Supergrupgr - avatar
7 Answers
+ 2
You just had extra curly braces on line 16, 44 and 48. It runs when I get rid of them
17th Apr 2018, 2:20 AM
cyk
cyk - avatar
+ 2
Also you have 2 if (answer == 8).
17th Apr 2018, 2:22 AM
cyk
cyk - avatar
+ 1
cyk new code btw the problem is now line 11 <!DOCTYPE html> <html> <head> <title>Page Title</title> <script> var answer = prompt("you have 2 gallons left how many miles do you go per gallon write a answer _ - _", "") if (answer == 25) { document.write("We stopped at a gas station 24 miles away, you get there and recieve 5 gallons") } if (answer == 2) { document.write("Woops you ran out of gas and got stranded, someone came to rescue you, you suddenly stop riding in the car") } } if (answer == 1) { document.write("Woops you ran out of gas and got stranded, someone came to rescue you, you suddenly stop riding in the car") } if (answer == 3) { document.write("you got lucky, there seemed to be one 4 miles away to the right") } if (answer == 4) { document.write("you got lucky, there seemed to be one 7.5 miles away to the left") } if (answer == 5) { document.write("you were really unlucky uou chose a bad place to camp, now you will be stranded there forever with a unusable car, and a dead phone") } if (answer == 0) { document.write("You were lucky and happened to find a gas station right next to you, you use a car charger for plugs, and use SOLOLEARN on your phone") } if (answer > 10) { document.write("there were gas stations 8 miles away in each direction, your care now has gas") } if (answer == 6) { document.write("you had 12 miles of gas, there was a sheetz 13 miles away, you had to walk one mile to ask for help but no one did, you are now stranded") } if (answer == 7) { document.write("in 3 directions each had a sheetz, one is 14 miles away, one is 15.6 miles away, one is 19 miles away, you head for the one 19 miles away and get stranded.") } if (answer == 8) { d
17th Apr 2018, 8:30 PM
Supergrupgr
Supergrupgr - avatar
+ 1
Get rid of the extra brackets on line 16, 44 and 48 like I said yesterday and let me know if it still misbehaves ā˜ŗ
17th Apr 2018, 8:51 PM
cyk
cyk - avatar
+ 1
Well, when I click on the codes you posted I get the same errors so maybe you want to update those links if you have more questions ā˜ŗ
18th Apr 2018, 1:40 AM
cyk
cyk - avatar
17th Apr 2018, 8:30 PM
Supergrupgr
Supergrupgr - avatar
0
I already did
18th Apr 2018, 1:38 AM
Supergrupgr
Supergrupgr - avatar