Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

loop through an array in js

let exampleArray = [1,2,3,4,5]; // The array to be looped over

// Using a for loop
for(let i = 0; i < exampleArray.length; i++) {
    console.log(exampleArray[i]); // 1 2 3 4 5
}
Source by hackernoon.com #
 
PREVIOUS NEXT
Tagged: #loop #array #js
ADD COMMENT
Topic
Name
4+6 =