[Solved] Converting an array object to another object-Part 2 in javascript


function yymmddToString(yymmdd) {
    var months = ['January', 'February', 'March', 'April' .....];
    var x = yymmdd.split('-');
    return months[parseInt(x[1], 10)] + ' ' + x[0];
}
var result = data1.reduce(function(result, datum) {
    var x = result[datum.name] = result[datum.name] || {};
    x[yymmddToString(datum.time)] = datum.value;
    return result;
}, {});

6

solved Converting an array object to another object-Part 2 in javascript