Q:

display array index value JavaScript

Lets say I retrieve data from my local api, using this snippet
{console.log("Bin", this.state.rows.filter(qc => qc.BinsByDayByOrchardsQCs.length > 0).map((bin) => bin))}

I retrieve a result that looks something like this 
    0: {…}
    1: {…}
    2: {…}

As a place holder, this is what I have
<div className="column-label qc-number">{this.state.rows.filter(bin => bin.BinsByDayByOrchardsQCs.length > 0).length}</div>

If I wanted to display each index value of that map, how would I be able to do that?

A:

{console.log("Bin", this.state.rows.filter(qc => qc.BinsByDayByOrchardsQCs.length > 0).map((bin, i) => i))}

Second argument in map method is the index. If you want to give them both back I suggest an array [bin, i] or object {bin: bin, index: i}

