Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

for loop on a array

var array = [1, 2, 3, 4, 5];
// made an array

for (var i = 0; array[i]; i++) // browse your array with this simple condition on index
	console.log('element '+i+' = '+array[i]);

//output:
element 0 = 1
element 1 = 2
element 2 = 3
element 3 = 4
element 4 = 5
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #loop #array
ADD COMMENT
Topic
Name
9+3 =