#How can I access the length = 4 property?

11 messages · Page 1 of 1 (latest)

hollow hull
#

[Array(4)]
0
:
Array(4)
0
:
{createUser: {…}, createDate: '2022-12-06T06:34:44.098043', updateUser: {…}, updateDate: '2022-12-08T12:35:05.894195', status: 'ACTIVE', …}
1
:
{createUser: {…}, createDate: '2022-12-08T14:15:24.305642', updateUser: null, updateDate: null, status: 'ACTIVE', …}
2
:
{createUser: {…}, createDate: '2022-12-08T14:27:18.70223', updateUser: null, updateDate: null, status: 'ACTIVE', …}
3
:
{createUser: {…}, createDate: '2022-12-08T14:29:41.924746', updateUser: null, updateDate: null, status: 'ACTIVE', …}
length
:
4
[[Prototype]]
:
Array(0)
length
:
1

     console.log(
          'resp',
          resp,
          'this.activeCircularizacoesList',
          this.activeCircularizacoesList,
          this.activeCircularizacoesList.length
        );```
 activeCircularizacoesList = []; is am empty array
glass harness
#

¿what?

hollow hull
#

I am not able to access the length = 4 property of this return from the backend it sent me in a strange way

#
this.service.findRequestsInvalid(idPartner).subscribe((resp) => {
        // resp['Array'].forEach((element) => {
        //   this.activeCircularizacoesList.push(element.name);
        // });
        this.activeCircularizacoesList.push(resp);
        console.log(
          'resp',
          resp,
          'this.activeCircularizacoesList',
          this.activeCircularizacoesList,
          this.activeCircularizacoesList.length
        );
      });```
#

resp (4) [{…}, {…}, {…}, {…}] this.activeCircularizacoesList 1

glass harness
#

Because you made an array of arrays. this.activeCircularizacoesList.push(resp);

#
const arr1 = [];
const arr2 = [ 1, 2, 3, 4 ];
arr1.push(arr2);
console.log('Arr 1', arr1);
Arr 1 [
  [
    1,
    2,
    3,
    4
  ]
]
hollow hull
#

Ah yes

#

I understood