Answers for "when to use loop and when to use array"

5

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
Posted by: Guest on August-04-2021
0

loop array

Array
(
    [id] => 11
    [username] => Edona!!!
    [password] => password
)
Posted by: Guest on July-15-2021

Code answers related to "when to use loop and when to use array"

Browse Popular Code Answers by Language