Answers for "an array with a loop"

1

loop an array in javascript

let array = ["loop", "this", "array"]; // input array variable
for (let i = 0; i < array.length; i++) { // iteration over input
	console.log(array[i]); // logs the elements from the current input
}
Posted by: Guest on May-18-2020
0

loop over an array

fruits.forEach(function(item, index, array) {
  console.log(item, index)
})
// Apple 0
// Banana 1
Posted by: Guest on July-02-2021

Code answers related to "an array with a loop"

Code answers related to "Javascript"

Browse Popular Code Answers by Language