populationEstimatePerYear = {
let sum = 0;
const populationEstimatePerYear = [];
uniqueListOfYears.forEach(key => populationEstimatePerYear.push({year: key, population: 0}));
population_data.forEach(getTotalEstimate);
function getTotalEstimate(row) {
for (let index = 0; index < uniqueListOfYears.length; ++index) {
if(populationEstimatePerYear[index].year == row.Year){
populationEstimatePerYear[index].population += row["Population estimates"] ;
break;
}
}
}
return populationEstimatePerYear;
}