I did not find a name for the qualification, but that’s what I don’t understand.
let's say we create an array using $ .map
var categoriesTemp = ['a','b','c']
var tempData = $.map(categoriesTemp,function(el,i){
return 0;
});
After that, I assign a temporary table to two variables
var vector1 = tempData;
var vector2 = tempData;
What I don't understand is that when I change the value in vector1, it affects vector2 and vice versa, for example:
vector1[1] = 1;
Two variables will have values:
Vector1 = [0, 1, 0]
Vector2 = [0, 1, 0]
I read the jquery documentation on $ .map but didn't find a hint. Can someone explain how this happens?
source
share