So I was testing this little peace of code:
<script>
var newData = {}, graphs = []
for(var j=0; j<2; j++){
newData["name"] = 'value '+ j
console.log(newData["name"]);
graphs.push(newData);
console.log(graphs);
}
</script>
I've got the following output in the webconsole:
value 0
Array [ Object ]
value 1
Array [ Object, Object ]
All Objects in the Arrays have the exact same Values:
name:"value 1"
I am really struggling with this because I don't change any values and the name is still changed in the same loop.
Thanks for your answers in advance!