Answers for "what is used to loop through arrays"

8

loop through an array in javascript

const array = ["one", "two", "three"]
array.forEach(function (item, index) {
  console.log(item, index);
});
Posted by: Guest on May-31-2020
0

loop through an array in js

let exampleArray = [1,2,3,4,5]; // The array to be looped over

// Using a for loop
for(let i = 0; i < exampleArray.length; i++) {
    console.log(exampleArray[i]); // 1 2 3 4 5
}
Posted by: Guest on August-06-2021

Code answers related to "what is used to loop through arrays"

Code answers related to "Javascript"

Browse Popular Code Answers by Language