Saved X
Google login
SignUp with Email
X

Random numbers javascript

theindreshverma ( Edited  Sep 30, 11:48 pm )
Login

Javascript Math.random() method.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Random numbers javascript</title>
</head>
<body>
    <h1 align="center">Random numbers javascript</h1>
    
    <p>Random number <b id="i1"></b></p>
    
    <p>Random number between 0 to 10<br><b id="i2"></b></p>
    
    <script>
    document.getElementById('i1').innerHTML = Math.random();
    document.getElementById('i2').innerHTML = Math.floor(Math.random() * 10);
    </script>
</body>
</html>

Sourcecode Tags

More Sourcecodes

More Sourcecodes