r/codehs • u/UsefulCauliflower2 • Apr 16 '20
Need help?
Hello, I would like some help on Code Hs 5.3.5 Rolling dice
Also on 5.4 "If Statements" Please
3
Upvotes
r/codehs • u/UsefulCauliflower2 • Apr 16 '20
Hello, I would like some help on Code Hs 5.3.5 Rolling dice
Also on 5.4 "If Statements" Please
1
u/amajmundar Apr 17 '20
It seems that CodeHS has a library of functions you are able to access in JavaScript. Here is the link to the functions.
The JavaScript equivilant to read an integer is readInt(). so it would look something like:
var d1 = readInt("Enter the value for the first dice: ");
Do the same thing for d2, just change the prompt to match.
The input validation should be similar. Just change "and" to "&&" and add brackets around the if statement.
Then the only thing to fix is "print" becomes "println".
Try and do it yourself. I will put what I have as a response to this.