0

I am currently learning JavaScript on Codecademy and I stumbled into some kind of problem. I am in a part called "Build Rock, Paper, Scissors" and there's a part where there is a condition saying that if Math.random() is bigger that 0.33 and smaller than 0.66, the computer will choose Paper. My question is, how do you make an if condition that says something is bigger than X, but simultaneously smaller than Y?

1 Answers1

1

Use logical operators && (and) and || (or) to combine conditionals:

if (x > 0.33 && x < 0.66) {
  // It is between!
}
Richard
  • 106,783
  • 21
  • 203
  • 265