V
V
votetomick2021-06-25 19:05:43
JavaScript
votetomick, 2021-06-25 19:05:43

What does this console entry mean?

60d5fed21178e318391078.png
How is it written in the line 3 false and in the column number 2 one true, isn't it the same thing that is displayed in this record in different formats? How to understand it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
profesor08, 2021-06-25
@votetomick

No need to panic. In JavaScript, all objects are passed by reference, with all the consequences.
This means that after the output to the console, the value of the array has changed. And when you unfold to see what's inside, you see the actual values ​​at the time of opening.
Just execute the code in the console, and open it later.

const arr = [false, false, false];
console.log(arr);
arr[2] = "test";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question