1

When doing a console.log of an array, I get the following results:

25 != 27 27 == 27

What does the number (25) represent in the first picture (at the top)? My array has a length of 27, not 25. I thought it was the count of non-null values, but the second picture tells otherwise.

The (25) and (27) are also present in the reduced form:

25 != 27 27 == 27

This happens in both Firefox and Chrome.

The code that leads to this behaviour:

var lows = ts2values[current_ts];
var highs = ts2values[current_ts];
console.log("lows b : ", lows);
console.log("highs b : ", highs);
lows.push(null);
highs.push(null);
console.log("lows a : ", lows);
console.log("highs a : ", highs);
asked May 20, 2020 at 12:50
0

1 Answer 1

1

What does the number (25) represent in the first picture (at the top)?

The length of the array at that time.

You can see the same result by the following code.

myArray = [1, 2, 3]
console.log(myArray)
myArray.push(4, 5, 6)
console.log(myArray)

the first log is Array(3)

console, not expand the array

and expanding the first log, the length of the array is 6, not 3 because it was updated after console.log

console, expand the array

answered May 21, 2020 at 12:15
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.