Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts
Thursday, April 25, 2013
Javascript loops are used to write diferent values with the same funtion.

EXAMPLE .1 

Void: write numbers from 0 to 9

Without loop:

<script type="javascript">
document.write(0+ "<br>");
document.write(1 + "<br>");
document.write(2 + "<br>");
document.write(3 + "<br>");
document.write(4 + "<br>");
document.write(5 + "<br>");

document.write(6 + "<br>");
document.write(7 + "<br>");
document.write(8+ "<br>");
document.write(9+
"<br>");
</script>

Now with a looping function:

<script type="javascript"> 

var x =0;
for (var i=0; i<10; i++)
  {
  x=x + i + "<br>";
  }

 </script>
 

DIGI CLOCK

======================

Categories

amasing (12) awesome (17) curiosities (37) html (1) javascript (1) lifestyle (18) ranking (2) scripts (3) showbizz (14) Sport (2) statistics (2) tech (7) tricks (5)