0

How to...

How to make random numbers in html, css, js?

22nd Nov 2017, 12:39 PM
КОрОлл
3 Answers
+ 2
Math.random() call in JS returns a floating point number between 0 and 1. Multiply by 10 to get a number between 0 and 10. Call Math.floor passing that number to get an integer between 0 and 9.
22nd Nov 2017, 12:49 PM
John Wells
John Wells - avatar
+ 1
Thanks!
22nd Nov 2017, 2:44 PM
КОрОлл
0
Technically you can only make random numbers using JavaScript. HTML is only markup and CSS is for design. Anyway, use Math.random().
22nd Nov 2017, 2:31 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar