<!DOCTYPE html> <html> <body> <h2>JavaScript Math</h2> <p>Math.floor(Math.random() * 30) returns a random integer between 0 and 30 (both included):</p> <p id="workingcode"></p> <script> document.getElementById("workingcode").innerHTML = Math.floor(Math.random() * 30); </script> </body> </html>
Output:
JavaScript Math
Math.floor(Math.random() * 30) returns a random integer between 0 and 30 (both included):
23
Math.floor JavaScript Function
Expert Asked question July 17, 2023