Why my Rover doesn't work ?!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Why my Rover doesn't work ?!!

It always give undefined when I enter a number and click on the button " F " . https://code.sololearn.com/Wu19y92JkAta/?ref=app

16th Dec 2018, 1:30 PM
Bono
Bono - avatar
7 Answers
+ 2
first, learn the meaning of class versus id, please use better names for ids, functions and so on as „h“, .... you have to define all function as log(),... you have to clean your code I tried to solved it, I modified it a little bit it is a good practice and a good idea 👍 https://code.sololearn.com/WE758RSusi3H/ref=app
16th Dec 2018, 4:27 PM
asa22
+ 8
Thanks a lot asa22 & KrOW for your valuable answers 😀.
17th Dec 2018, 1:05 AM
Bono
Bono - avatar
+ 7
KrOW How to avoid that mistake !!
16th Dec 2018, 2:45 PM
Bono
Bono - avatar
+ 6
KrOW yes I know, but this time I don't want to make it move when the window is loaded , I want to make the Rover move when we click on " F " button or any button.
16th Dec 2018, 2:33 PM
Bono
Bono - avatar
+ 3
Bono you have receveid good hints by asa22. Follow them 😉
16th Dec 2018, 7:48 PM
KrOW
KrOW - avatar
+ 1
Bono Its same problem that you has here https://www.sololearn.com/discuss/1621719/?ref=app if you dont understand something said in that thread, get me know
16th Dec 2018, 2:28 PM
KrOW
KrOW - avatar
+ 1
Bono I have inspected better your code and i finded some other problems like document.getElementsByClassName that return a collection (eg. Array loke object) but you use it like returning a single element
16th Dec 2018, 2:34 PM
KrOW
KrOW - avatar