uncaught reference error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

uncaught reference error

Can you guys help me with this code. I’m not sure what I’m doing wrong. I tried to execute the same code on my VS Studio and chrome console is giving me reference error saying “greeting is not defined” why and how can I solve this error? https://code.sololearn.com/WzHpI5iPxJ2X/?ref=app

3rd Jul 2020, 3:51 PM
Yamkela Mazwi
Yamkela Mazwi - avatar
4 Answers
+ 5
You are missing closing brackets ("}") on both the testFunc() function and the else clause within it. Also, you need getElementById, not getElementsById.
3rd Jul 2020, 3:56 PM
Russ
Russ - avatar
+ 2
No problem Yamkela Mazwi 👍😉
3rd Jul 2020, 4:00 PM
Russ
Russ - avatar
+ 1
much appreciated thank you
3rd Jul 2020, 3:59 PM
Yamkela Mazwi
Yamkela Mazwi - avatar
0
Mistake 1:You forgot 2 } at the end Mistake 2: it's not getElementsById. It is getElementById.
3rd Jul 2020, 4:00 PM
Andrei I
Andrei I - avatar