How may I build a function in javascript that do the following :
Input :
var data = [null, 1, 2, 3, null, null, 2, null, 4]
output:
dataset = [
[null, 1, 2, 3, null, null, null, null, null],
[null, null, null, null, null, null, 2, null, null],
[null, null, null, null, null, null, null, null, 4],
]
in fact in this example, my input have 3 set of no null values : these sets are : [1, 2, 3], [2] and [4]
from these sets I want builds arrays that have these values (of not null sets) and that conserve the same index as the input array
Thank you