What is the simplest way to generate a random number between 0 - 9 (inclusive both) excluding 6 in Javascript?
Here is your one line solution :(
[0,1,2,3,4,5,7,8,9][Math.floor(Math.random()*9)]
Generate a random number between 0 and 8 and then add 1 if it's >=6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With