0
[Object, Object, Object, Object]
[Object, Object, Object, Object]
[Object, Object, Object, Object]
[Object, Object, Object, Object]
[Object, Object, Object, Object]
[Object, Object, Object, Object]
Has several arrays
on a page and need to count them. Heed: I don’t want to use the length
to find out how many items there are in each array
and know how many arrays
has the whole.
For example, in the list above I would return the number 6 (total of arrays
).
I have a fixed test array:
$scope.tickets = [{
name: 'Pista Inteira - Lote 01',
items: [{
type: 'Homem',
value: '100,00',
quantity: 0
}, {
type: 'Mulher',
value: '80,00',
quantity: 0
}]
},
{
id: 1,
name: 'Pista (PNE)',
items: [{
type: 'Homem',
value: '100,00',
quantity: 0
}, {
type: 'Mulher',
value: '80,00',
quantity: 0
}]
},
{
id: 2,
name: 'Camarote',
items: [{
type: 'Homem',
value: '100,00',
quantity: 0
}, {
type: 'Mulher',
value: '80,00',
quantity: 0
}]
},
{
id: 3,
name: 'Lounge',
items: [{
type: 'Homem',
value: '100,00',
quantity: 0
}, {
type: 'Mulher',
value: '80,00',
quantity: 0
}]
},
];
I run this array several times and would like to count how many times this array has been generated.
Can anyone tell me how to do it?
has the example of this set of
arrays
?– novic
And where are these array on the page? Where do these come from array?
– Woss
I’ll edit the question
– Edinho Rodrigues
you want the amount of arrays inside each key
items
?– novic
How are these arrays generated? Anything encapsulates them in another array using
push
and take the length of it– Lucas
I don’t see multiple arrays, I see an array of objects that contains array.
– Maurivan
@Using no proposed solutions has served you?
– novic