Please look at the example below and follow the steps below.
Open the console.
Click the button several times (more than three times). Then, number 1 will be added to the array and the array will be logged in console. Be careful not to expand the results.
Expand the results which have only one or two elements.
If you followed the steps, you may have noticed the expanded array has more elements they are supposed to have. This is because it reflects current status of the array.
The Chrome says it really does. If you expand, you can check a blue tooltip. If you put the cursor on it, it says like this.
"This value was evaluated upon first expanding. It may have changed since then."
If you want to maintain the original forms, you can do it by expanding before clicking.
The browser treats objects in the same way as arrays.
Check it through the example below and by ways that I mentioned above.