Use the random() method to display a random number. - Javascript Math

Javascript examples for Math:Quiz

Description

Use the random() method to display a random number.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = Math.random();
</script>//  w  w w  . ja va2s .  c om

</body>
</html>

Related Tutorials