JSFiddle - React, Tailwind, and code Playground
by Sub Taper
JavaScript
function x(data) {
var r = [], temp;
data.forEach(function (a, i) {
if (!(i % 3)) {
temp = [a[1]];
r.push(temp);
}
temp.push(a[2]);
});
return r;
}
var data = [['ANSWERED', '477', 728], ['BUSY', '477', 48], ['NO ANSWER', '477', 277], ['ANSWERED', '478', 88], ['BUSY', '478', 24], ['NO ANSWER', '478', 56]],
result = [['Call Disposition', 'Answered', 'Busy', 'Failed']].concat(x(data));
document.write('<pre>' + JSON.stringify(result, 0, 4) + '</pre>');