loop through array in modern javascript code example
Example 1: javascript loop through array
const numbers = [1, 2, 3, 4]
numbers.forEach(number => {
console.log(number);
}
for (let i = 0; i < number.length; i++) {
console.log(numbers[i]);
}
Example 2: how to use for loops to work with array in javascript
let myArray = ["one", "two", "three", "four"];