Random() to return a random number between 0 and 10

Saranya Boopathi
Posted by Saranya Boopathi under JavaScript category on | Points: 40 | Views : 1447
Random() to return a random number between 0 and 10

<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button</p>
<button onclick="myNum()">Get New Number</button>
<script>
function myNum()
{
document.write(Math.floor(Math.random()*10));
}
</script>
</body>
</html>

Comments or Responses

Login to post response