Why the object shows 6, and the value of length 8?

Hello, goskagit why there are different indexes ? 6 and 8 ? I did add to the array was done via PUSH in the cycle.
5e9838fe0f3e4890134010.png
April 19th 20 at 12:19
1 answer
April 19th 20 at 12:21
As I recall, this may happen if after you did console.log this array, you have to something in writing, ie he has changed.
Here:
The original array
The function which he adds,
And the conclusion
5e983a28e6753858658481.png
5e983a34b5059875150009.png
5e983a3f39acb313154895.png - Henderson12 commented on April 19th 20 at 12:24
once you've done console.log this array, you have to something in writing, ie he has changed


@Henderson12,
and here comes what looks like 2 result, and they pusaude in the original array of 6 elements?

5e983a34b5059875150009.png

the first render is called BEFORE the result of the axios, the second is with the result, just console.log updated so try the render to write to console.log(JSON.stringify(PortfolioList)) to explicitly capture the state of the array at the time of withdrawal

Why the object shows 6, and the value length 8

if in the console to bring the blue square i , then chrome about it and write that the value of the object is recalculated at the moment, not at the time of output to the console - Ariel34 commented on April 19th 20 at 12:27

Find more questions by tags JavaScript