This is a follow question from https://stackoverflow.com/questions/34981100/jquery-loop-to-generate-variables
So i'm trying to make variables in newly created arrays in my function. Then i will have to call each newly created variable to my chart.
var digits = [2012, 01, 5, 88, 2012, 01, 6, 90, 2012, 05, 9, 130];
size = 3;
data = []
while (digits.length > 0)
data.push(digits.splice(0, size));
var mysize = data.length;
for (i = 0; i < data.length; i++) {
x = 0
console.log("This is set " + i)
console.log('This is the data for array ' + i + '\n ' + data[i])
for (j = 0; j < 3; j++)
console.log(data[i][j])
MY second console.log statement prints out arrays in sets of four. I need to name each of those arrays, and then i need to be able to call each individual array in my chart, which is in a separate function.
Right now each array is named from the line
console.log('This is the data for array ' + i + '\n ' + data[i])
with no variable set from this line.
The end result should be my1 = [2012,1,5,88] my2 = [2012, 1,6, 90] my3 = [2012, 5, 9, 130] And since the data from my array could scale I wont be able to know how many new variable arrays i need to make. That's why the code should auto generate new array variable names, and break the original data into sets of four.
Then i would have to pass each newly created variable separately into my chart.