for loop through an array with javascript

looping through an array with javascript using a basic for loop

Javascript

var my_array = [1,2,3,4,5,6,7,8];
var i;
var text;
for (i = 0; i < my_array.length; i++) { 
  text += my_array[i] + "<br>";
}
console.log(text);

Demo

Other Items in javascript
Page Views

This page has been viewed 80 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹