having trouble adding js to my game | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

having trouble adding js to my game

HELP!

23rd Nov 2018, 1:54 PM
elcarlitos
elcarlitos - avatar
10 Answers
+ 4
Can you explain in detail whats your problem??
23rd Nov 2018, 2:01 PM
Divanshu Mehta
+ 1
hey thanks for the reply mehta! Is on my game "Rock Paper Scissors", seems like the code I plugging isn't right. the code I'm trying to configure is for the user and computer score to work, to tell is time the user or computer wins. I'll put my project on public so you and anyone can take a look ok. I'll write you the code I'm trying to configure maybe I'm not writing correctly.
24th Nov 2018, 9:28 PM
elcarlitos
elcarlitos - avatar
+ 1
I've fixed all bugs in your code. Check it out: https://code.sololearn.com/WdkPpDXOk5eG/?ref=app
25th Nov 2018, 3:01 AM
Divanshu Mehta
+ 1
are you serious? wow thank you so much! sorry I'm a beginner. I appreciate your help.
25th Nov 2018, 3:05 AM
elcarlitos
elcarlitos - avatar
+ 1
No problem man, i am to pleased to help you. Just keep practicing. Beleive me, you write really nice code as a beginner. And yes you can ask me any question anytime. And also you don't have to link css and javascript in sololearn app, because sololearn automatically link that stuff But if you are working on some kind of ide then you have to link css and js with link and script tag.😊
25th Nov 2018, 3:43 AM
Divanshu Mehta
0
this is the code I'm trying to configure in js function game(userchoice) { const computerChoice = getComputerChoice(); switch (userchoice + computerChoice) { case "rs": case "pr": case "sp": break; win(); } } function main() { rock_div.addEventListener('click',function (){ game ("r"); }) paper_div.addEventListener('click',function (){ game ("p"); }) scissors_div.addEventListener('click',function (){ game ("s"); })
24th Nov 2018, 9:30 PM
elcarlitos
elcarlitos - avatar
0
please give yourself credit too. couldn't work without your help my friend.
25th Nov 2018, 3:08 AM
elcarlitos
elcarlitos - avatar
0
mehta, so I when over the fixes you made, saw that you do not need a <script js.</script> in this app. I thought we needed to specify this. also you use variables in js. overall I want to thank you, I see I was over thinking this to much- I'm learning through my note++ on my computer, but I see this app is already link to ccs and java. again, thank you so much. will be asking you more questions if you don't mind.
25th Nov 2018, 3:26 AM
elcarlitos
elcarlitos - avatar
0
thank you, and I'll be coding more often. I made the game public gave you credits. thanks.
25th Nov 2018, 4:01 AM
elcarlitos
elcarlitos - avatar
0
hey mehta, I updated the game, check it out. is not much of an upgrade but is something lol
30th Nov 2018, 10:37 PM
elcarlitos
elcarlitos - avatar