JSFiddle - React, Tailwind, and code Playground

by Christophe POT

HTML

Look at the console.

JavaScript

var my = [{
    "Month": "September",
    "Value": 1681937,
    "Year": 2013
}, {
    "Month": "April",
    "Value": 2138286,
    "Year": 2014
}];

console.log('my (before) :', my);

for(var i=0; i<my.length; i++) {
    my[i]["Value" + my[i].Year] = my[i].Value;
    delete my[i]["Value"];
}

console.log('my (after) :', my);