Hey there fellow JavaScript enthusiasts!
I am working with an array that I created from data extracted from a csv file. Here's a snippet of how it looks:
https://i.sstatic.net/tczVz.png
Each index in the array, for example array[0], represents the headers with a total of 87 in this instance. The subsequent arrays within the array represent the rows of data.
My goal is to extract and organize this data into columns.
The code snippet below accomplishes this task but only for the first column:
var specialCounter = 0;
for(var j = 1; j<vm.lines.length; j++){
vm.columns.push(vm.lines[j][0]);
if(specialCounter >= vm.lines[j][0].length)
specialCounter = 0;
else
specialCounter++;
}
vm.columnData.columnData= vm.columns;
console.log(vm.columnData);
Here's the array output generated by the code above:
https://i.sstatic.net/Khwvc.png
How can I extend this logic to work with all columns in the array?
Perhaps utilizing a structure like
vm.dataPerColumn = [{column1: [...], column2: [...], etc...]