JS Code Error!!!!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

JS Code Error!!!!!!

I have almost completed my most of the JavaScript Code of my Game , for testing I wanted to see that whether it's Running or Not , It's Running but not as I want. According to me it should so – "Computer choice: Rock paper or scissor" instead its showing – "Computer choice: botchoice" In the Console. And it's also showing something – "[ObjectHtmlImageElement]" in the Console , I don't know why it is doing so ????? I think that my Syntax is almost right but I can't find the error. Below is My code Please check and solve my error!!! , I'll really be very very thankful – https://code.sololearn.com/W55eRi8eRlnx/?ref=app

25th Jul 2020, 6:19 AM
_Levi_
_Levi_ - avatar
2 Answers
+ 1
So the first issue is just because you have quotes around "botchoice" referring to it as a string instead of a variable. The second issue is cause because rpsgame(this) passing this refers to the img element. You then print it causing [objecthtmlimgelement] to be printed
25th Jul 2020, 7:36 AM
JME
0
JME thanks a lot......😊😊😊😊
25th Jul 2020, 7:41 AM
_Levi_
_Levi_ - avatar