JavaScript Program to Print Numbers from 1 to 10

Write a JavaScript program to print numbers from 1 to 10 using while loop.



Source Code
<html>

<head>
    <title>Display Numbers from 1 to 10</title>
</head>
<body>
<h3>Numbers from 1 to 10 are</h3>
<script type="text/javascript">
    var a = 1; 

    while (a <= 10) 
    { 
        document.write(a + "<br />"); 
        a++; 
    }
</script>
</body>
</html>
Output