min_max = {
function min_max_f(data) {
let min = 100;
let max = 0;
data.forEach((country, idx) => {
for (const year in country) {
if (country[year] !== 0 && Number(year) > 1960) {
if (min > country[year]) min = country[year];
if (max < country[year]) max = country[year];
}
}
});
return [min, max];
}
const life = min_max_f(life_expectancy);
const pop = min_max_f(population);
const fert = min_max_f(fertility_rate);
return { life, pop, fert };
}