I have a class in JS like this:
function configurationToken(){
this.setData= function(data){
this.data=data;
};
this.configurationState=[];
this.analyse= function(){
#first loop to get an array called this.configurationState
#second loop to update this.configurationState
#and put each updated state in array called trail.
for(var i=0;...;..){
this.configurationState[i].parameterValue = some number related to i
this.PSTrail.push(this.configurationState);
}
#results in the final array
console.log(this.PSTrail);
}
}
the problem is the objects in this.PSTrail array are all the SAME, which means in the second loop, the code pushed "this.configurationState" without changing the parameterValue, anybody knows why?? Thanks!