Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript loop through array

const myArray = ['foo', 'bar'];

myArray.forEach(x => console.log(x));

//or

for(let i = 0; i < myArray.length; i++) {
  console.log(myArray[i]);
}
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #javascript #loop #array
ADD COMMENT
Topic
Name
3+2 =