Uncaught TypeError: Object.values is not a function JavaScript

.values is unsupported in many browsers – you can use .map to get an array of all the values:

var vals = Object.keys(countries).map(function(key) {
    return countries[key];
});

See MDN doc: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values or Official doc: https://tc39.github.io/ecma262/#sec-object.values (thanks @evolutionxbox for correction)

Leave a Comment