I have the following code.
The code iterates over a collection of jsonRow objects, they are pushed onto a jsonRows array, then the jsonRow object is reset property by property.
This reset causes the jsonRow object in the jsonRows array to become affected. Any clues to this behavior?
for(iterating over collection of jsonRow objects){
if(0 < jsonRow.id.length && 0 < jsonRow.title.length){
jsonRows.push(jsonRow);
console.log('jsonRow in jsonRows is intact', jsonRows);
for(var prop in jsonRow){
jsonRow[prop] = '';
}
console.log('jsonRow properties in jsonRows are ""', jsonRows);
}
}