To loop through an array without using array size with Node, we use the forEach
method.
For instance, we write
const myArray = ["1", "2", 3, 4];
myArray.forEach((value) => {
console.log(value);
});
to call forEach
with a callback that gets the entry in myArray
being looped through.
We get the value being looped through from value
.