mercredi 1 avril 2015

In nodeJs is there a way to loop through an array without using array size?

Let's say I have



myArray = ['item1', 'item2']


I tried



for (var item in myArray) {console.log(item)}


It prints 0 1


What I wish is to have item1 item2


Is there any other syntax that works without using



for (var i = 0; i < myArray.length; i++)

Aucun commentaire:

Enregistrer un commentaire