Is there a short hand notation for iterating through a javascript array that yields the actual object, instead of the index of the object?
For example:
var dataset = ['a','b','c']
for (item in dataset){
console.log(item);
}
I want to log 'a','b','c' -- not 0,1,2.
My reason for not wanting to use dataset[item] is that I have several nested for loops, and the code is getting very verbose.
Array.prototype.forEach-- pretty much every lib offers a flavour of this (e.g. $.each, _.each) or use ES6for .. of ..and transpilefor ... inis for objects, not arrays.for inloops on arrays!