I am having problems with this code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

I am having problems with this code.

For some reason I keep on getting this error: "Syntax Error: Unexpected end of script." https://code.sololearn.com/WuQ0Dp8XDQn0/?ref=app

10th Oct 2018, 5:29 PM
Elijah D
Elijah D - avatar
8 Answers
+ 3
It's because you declare variable that has the same name "bike" which overwrites your function and that's why it says that the function is not defined. Function and variable can't have the same name.
10th Oct 2018, 5:52 PM
Toni Isotalo
Toni Isotalo - avatar
+ 5
I closed the bike function, but I am still getting errors.
10th Oct 2018, 5:48 PM
Elijah D
Elijah D - avatar
+ 5
Thanks Toni Isotalo. Now the code returns error in the alert, wether I check bike or not.
10th Oct 2018, 6:11 PM
Elijah D
Elijah D - avatar
+ 5
Thanks Toni Isotalo.
10th Oct 2018, 6:16 PM
Elijah D
Elijah D - avatar
+ 3
You didn't close your bike() function. You're missing one } bracket
10th Oct 2018, 5:38 PM
Toni Isotalo
Toni Isotalo - avatar
+ 3
"test" variable is a string because you store the checkbox value to it so it doesn't have .checked property which makes it false.
10th Oct 2018, 6:13 PM
Toni Isotalo
Toni Isotalo - avatar
+ 3
dude it's working.by the way,nice code
21st Oct 2018, 11:29 AM
<html>SAMEER POSWAL</html>
<html>SAMEER POSWAL</html> - avatar
+ 2
you haven't close the bike() function, add another } there
10th Oct 2018, 5:39 PM
Taste
Taste - avatar