Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • While-loop in Javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 111
    Comment on it

    The JavaScript while loop iterates the elements for the infinite number of times. It should be used if number of iteration is not known.
    The syntax of while loop is given below-
    while (condition)
    {
    code to be executed
    }

    Below is the simple example of while-loop:

    <!DOCTYPE html>
    <html>
    <body>
    <script>  
    var i=10;  
    while (i>=1)  
    {  
    document.write(i + "<br/>");  
    i--;  
    }  
    </script>  
    </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: