To fix Uncaught TypeError: Object.values is not a function JavaScript, we can use Object.keys instead.
For instance, we write
const vals = Object.keys(countries).map((key) => {
return countries[key];
});
to get the keys from the countries object with Object.keys.
Then we call map with a callback to get the value from each key in countries and return the array of values.