Answers for "how to print array elements using for loop in javascript"

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
0

javascript loop and array

var array = ["hello","world"];
array.forEach(item=>{
	console.log(item);
});
Posted by: Guest on June-27-2020

Code answers related to "how to print array elements using for loop in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language