Answers for "cicle through array hs"

7

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]);
}
Posted by: Guest on November-16-2020
7

iterate through array javascript

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

Code answers related to "Javascript"

Browse Popular Code Answers by Language