Let’s say I use Math.random and Math.floor to generate a number between 1 - 10. If it produces an even number I want to it run a certain statement like document.write(‘you win’). If it’s odd, then I want it to run another statement such as document.write(‘you lose’). I tried making a variable equal to an array and putting the even numbers in it but I couldn’t find a way to make it write a statement if one thing in the array is true.
math.random generates random number between 0 and 1, so to get 50%, you will simply need to check if the random is less then