I have the following.
var dataset = {val1 : 0, val2 : 0, val3 : 0};
var person = [];
var totalPeople = 10;
for(var i = 0; i <totalPeople; i++) {
person[i] = dataset;
}
Why i chose this approach, click here
.
I'm trying to make one of the values auto increment inside another for
loop.
I've tried the following approaches to no avail.
person[1]{val1 : 0,
val2 : 0,
val3 : val3 + 1};
person[1]{val1 : 0,
val2 : 0,
val3 : person[1].val3 + 1};
person[1].val3 = person[1].val3 + 1;
any ideas?