On the one hand you could write array.forEach(function(item){})
or you could write for each(let item in array){}
I'm trying to understand when it is better to use each method of looping over items in a Javascript array.
Thanks!
On the one hand you could write array.forEach(function(item){})
or you could write for each(let item in array){}
I'm trying to understand when it is better to use each method of looping over items in a Javascript array.
Thanks!