A strange thing happened there.
I usually assign my global variables as follows:
orders = []; pOrders = [];
But I was lazy and just wrote:
orders = pOrders = [];
That should mean the same thing, right?
Apparently not because the pOrder array also contained the data from the orders array. I sat for 15 minutes, looking for an error in my code, but could not find anything, so I just tried to write the variables, as I usually did, and it worked. Why is this happening?
In PHP, the logic will be the same, but JavaScript seems to behave differently.
Please someone can provide me some information or knowledge.
source share