javascript loop through number code example
Example 1: 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]);
}
Example 2: javascript array loop
const friends = [
`Dale`,
`Matt`,
`Morne`,
`Michael`,
];
for (let i = 0; i < friends.length; i++) {
console.log(friends[i]);
}