Javascript Object of Arrays manipulation
May i suggest a shorter code?



var data = {
  dataGroup: {
    count: [4, 4, 2, 1],
      dataOne: [1, 3, 2, 1],
      dataTwo: [7, -1, 9, 0],
      dataThree: [3, 8, 1, 2]
  }
}

var processedData = Object.keys(data.dataGroup).filter(key =&gt; key != 'count').reduce((acc, key) =&gt; {
  acc.groupName[key] = [];
  data.dataGroup.count.forEach((amount, index) =&gt; {
    for (let i = 0; i &lt; amount; i++) {
      acc.groupName[key].push(data.dataGroup[key][index]);
    }
  });
  return acc;
}, { groupName: {}});
console.log(processedData);