when I try to set a value in an array in javascript, all the other "adjacent" values change as well.
var screenData = [];
function init() {
var properties = { "property": "value" }
for( i = 0; i < 35; i++ ) {
var row = [];
for( j = 0; j < 19; j++ ) {
row.push(properties);
}
screenData.push(row);
}
}
init();
screenData[0][0].property = "othervalue";
alert(screenData[0][1].property);
The alert will return othervalue
although it should be value
:(
Did I just oversee something or is this a bug?
Any help would be appreciated :3