Home
Run >
<!DOCTYPE html> <html> <head> <!-- www.techstrikers.com --> <title>My first Javascript code</title> </head> <body bgcolor="#bnde45"> <fieldset> <legend>Javascript For Loop</legend> <script type="text/javascript"> for (j=0; j<=10; j++) { document.write("<b>The number is " + j + "</b>") document.write("</br>") } </script> <p>Explanation: <p>The for loop sets <b>i<b> equal to 0. <p>As long as <b>i</b> is less than or equal to 5, the loop will continue to run. <p<>b>i<b> will increase by 1 each time the loop runs. </fieldset> </body> </html>