I don't understand what's happening here - in the below code I have an array of JSON objects. If I console log the array, and after the console log set a new property in one of the objects - the console log before this is showing the property.
How can this happen, if I'm doing logging the console before I assign the property?
It's causing a bigger issue for me, as I'm trying to set a property within a loop but clearing the array after a new action so the property isn't set for another event - but it just keeps setting the property and won't reset the array...
var sizes = [];
var sizes = [{title: 'S', id: 1}, {title: 'M', id: 2}, {title: 'L', id: 3}];
console.log(sizes);
sizes[1]['selected'] = true;