How can I implement a simple function in JavaScript that generates a random positive number that consists of only two digits?
For a random number between 10 and 99, use:
Math.floor(Math.random() * 90 + 10)
jsFiddle demo: http://jsfiddle.net/zjLY6/
Try
Math.random().toFixed(2)*100
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