JavaScript Help!!! Can someone help me out with if/else statements?
@dan815 @iambatman @Nnesha
I am trying to create a simple game of rock paper scissors. Can someone help?
Yes, yes we can
No Offense, But this is so easy to do. 5 Year old could read a book and do this. Why are you taking a java course if you can't make a simple Rock, paper, and scissor game?
@Tester97, I am not taking a course. This is more of a hobby. I don't care if a 5 year old could do it, the point is that I'M the one that needs help. Now please, Help, or leave. @Jaynator495 , Will you help?
Zyi6, First off, if this was a hobby. You wouldn't be on a site that is poorly ran, and 80% of these people know nothing about programming. You are best off going to a real forum, and getting help.
Would you like this done through the js console, through a text box, or through a prompt and yes it is very easy -_-
js console
As of right now, I know that I need to start by declaring a function with 3 parameters, for rock, paper, and scissors, correct?
var options = ["paper", "rock", "scissors"], result = [" ties ", " beats ", " loses to "], i = Math.floor(Math.random() * 3), randomChoice = options[i]
^you forgot some things there, like what loses/wins/ties... and also the input XD
var options = function (rock, paper, scissors) {} Does that look like the correct starting point?
Hello?
Jay, I wasn't finish.
oh ._.
I just wanted to know if she could build off of that.
ohxD
I am a he, thank you very much.
._. #Awkward
^O-o i didn't know about that website... *instantly bookmarks website*
There are many ways to go about the same project - I find first making the algorithm then diving into the code works quite well. I'm not well versed in JS, but for rocks paper scissors (rps) I'd say ``` 1. user inputs their choice of r, p, or s 2. computer randomly picks it's choice 3. a function is called that takes the user's and computer's picks, and it figures out if user wins, loses, or it's a draw 4. result is displayed to the user ```
Join our real-time social learning platform and learn together with your friends!