Let us guess two objects with same property:
var x = {a : \'some\'},
y = {a: \'some\'};
output:
x == y; and x
This happens because
var p = [1, 2, 3],
q = [1,2,3];
creates two instances of arrays. Equality operators in JS, when comparing non-primitive data, only check if they are the same instance, don't do deep check of values or properties.
With code
var p = q = [1, 2, 3];
you are creating ONE instance of the array and assign this instance to variables p and q. So, both variables store reference to the same instance, so equality operator will return true.