loop throuhg array return first index code example
Example 1: foreach jas
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));
Example 2: iterate through array js
let arbitraryArr = [1, 2, 3];
// below I choose let, but var and const can also be used
for (let arbitraryElementName of arbitraryArr) {
console.log(arbitraryElementName);
}