• Archives

  • For Loop in javascript

    By admin | November 5, 2007

    Looping is an essential part of programming you can use looping structure to loop through arrays , variables , etc

    Using it

    <html>

    <head>

    <title>Easytutorial.info for loop in javascript</title>

    </head>

    <body>

    <script type=”text/javascript”>

    var r = 10

    for(i=0;i<=r;i++)

    {

    document.write(“Welcome to easytutorial.info <br>”)

    }

    </script>

    </body>

    </html>

    the above script will print 10 times

    welcome to easytutorial.info


    for(i=0;i<=r;i++)

    understand the above statement

    for (i=0 <!– Assigning 0 to i

    ; <!– Sepration Operator –>

    i < = r <! — Condition –>

    i++ <!– Incrementation –>

    { <!– Inside this bracket the code will be executed>  }

    Topics: Javascript | 3 Comments »

    Related Links: