How would I count how many objects there are inside an array?
The array looking like:
[ {id: 1}, {id: 2}, ...]
I assume I could use
Use .length
var data = [{ id: 1 }, { id: 2 }]; console.log(data.length);
Update, in your edit I see that
offer.items_to_receive is undefined, ensure that object offer has property items_to_receive (should be array);
offer.items_to_receive
undefined
offer
items_to_receive