<HTML>

<HEAD>
<TITLE>For Loop example</TITLE>
</HEAD>

<BODY>

<SCRIPT>
/*This script will demonstrate a for loop*/

var x =0;// declaring and intializing integers

for (var i = 0; i < 4; i++)
{
x += 2;
alert("\nx =" +x+ "\n i = " +i);
}


if (i == 5)
{

alert("True");
i += x;
}
else
{

alert("False");
i += (x+2);
}

alert("\ni=" +i);
</SCRIPT>
 

</BODY>
</HTML>
 

 

 

 

 


 
Run Script Sample Output