convert month to number javascript code example
Example: convert integer month to string month react native
var label = [{month: 9, revenue: 400},
{month: 11, revenue: 500},
{month: 12, revenue: 600}]
var months = [];
var revenue = [];
var m = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];
label.forEach(function(value){
var monthName = m[value.month - 1];
months.push(monthName);
revenue.push(value.revenue);
});
console.log('Months Array: ', months);
console.log('Revenue Array:', revenue);