Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
6+7 =