I have an object that contains the follow structure
{
Apples: Array[1],
Mangos: Array[2],
Oranges: Array[5],
Bananas: Array[11]
}
These values are extracted using a
_.forEach(contents, function(values, key) {
}
Where the key = apples
and the values
would be the array. I am wondering how I can get the current index within this foreach
loop ?
i.e. so I get 1,2,3,4
? There may not be a way to do this other than to push them to an array ?