How can i loop through an array in javascript?

You can use various loop constructs in JavaScript to iterate through arrays, such as `for`, `for..of`, and `forEach`. Example:

let fruits = ['apple', 'banana', 'cherry'];
for (let i = 0; i < fruits.length; i++) {
    console.log(fruits[i]);
}

fruits.forEach(fruit => console.log(fruit));
The examples above show two different ways to loop through an array.

Beginner's Guide to JavaScript