I am new to JS and need some basic help:
I have a spreadsheet which has a square matrix of data.
I can read these data as follows:
var freq
Someone much smarter than myself could probably help you write this better, but the way it looks to me is that you want to create tempArr as the main array, which would have 2 arrays inside of it.
Inside of each of those arrays are values, so:
// result: tempArr = [[1,2],[4,5]]
tempArr = [] // or new Array
for (var i = 0; i <= 3; i++) {
tempArr[i] = [];
for (var j = 0; j <= 3; j++) {
tempArr[i].push(freqArr[i][j]);
}
}
You create your first main array in tempArr, within your for, each time you loop through, tempArr[i] is created as an array, and inside of the second for, you want to push the value of freqArr to the inner array.
UPDATE Had a space in tempArr[i] that would've caused it to not work for sure. Sorry!