I am working on a part of the code where I have an array which looks like [[data]]
. The data
is rendered on the server side through the Django temp
Javascript is like Java in that the ==
operator compares the values of primitive types, but the references of objects. You're creating two arrays, and the ==
operator is telling you that they do not point to the same exact object in memory:
var b = new Array( 1, 2, 3 );
var c = new Array( 1, 2, 3 );
console.log(b == c); // Prints false.
console.log(b == b); // Prints true.
console.log(b === c); // Prints false.
b = c;
console.log(b == c); // Now prints true.
You have to do a deep comparison by hand if you want to compare the values of the objects.