I'm getting an odd issue with a nested array I have in a program I'm working on.
When I print out the nested array in console.log as a set of values it prints out correctly.
Ex.
console.log("Array: " + arr) //Array: 0,0,0,0,0,0,0,1
However when I print them out as the object I'm getting entirely different values right after it. After expanding it out on chrome's developer tools I get.
console.log(arr)//(2)[Array(2), Array(2)]
0: [2][1,4]
1: [2][0,1]
Sometimes javascript/developer tools are weird and so I'm consulting SO.
I don't believe I have pointer issues where between the two print statements something is accessing a value in the arr
. They happen right after eachother and the basic pseudocode on the main nested array manipulation is a simple increment of +1.
I couldn't find anything online, but wanted to confirm there are no odd issues with chrome developer tools or javascript when printing objects vs. values. Unfortunately, I believe this is as concise an example I can make and don't know what example code would be otherwise helpful in this case.
One other odd issue I'm seeing on the same matrix object that when I try to access an element i.e arr[0][0][0]
I'm getting an entirely different value than I would have expected.
Thanks in advance and if there turns out to be no known issues/considerations with either the developer tools or javascript then I will close this post.
Update: In the developer tools this line when expanded:
Returns an entirely new set of values. As you can see, the 14 became 67 when expanded out.