For Loops

Javascript Forloop

The For Loop is used to grab data, bit by bit (in layman’s terms)

 

This is a For Loop that just prints to screen the numbers 0 to 10:

Var i=0
for (i=0;i{
document.write (i+”
”);
}

To print/display on a webpage, all the names in a list you could use this code:

var i = 0;
var names = new Array();
names[i++] = ‘Roger’;
names[i++] = ‘Ryan’;
names[i++] = ‘Royce’;
document.write(‘Gracies
‘);
for (var j = 0; j ‘);
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s