JSFiddle - React, Tailwind, and code Playground
JavaScript
const countries = ['Belgium', 'Uk']
const years = ['2019', '2018', '2017']
const colors = ['red', 'orange', 'green']
const dataset = [];
countries.forEach((country)=>{
years.forEach((year)=>{
const obj = {
country: country,
year: year
}
colors.forEach((color)=>{
obj[color] = Math.floor(Math.random() * 300) + 1;
})
dataset.push(obj);
})
})
console.log(dataset);