Uncaught TypeError: Object.values is not a function JavaScript
For those who ended up here and are using Angular, adding import 'core-js/es7/object';
to polyfills.ts
file solved the problem for me.
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/array';
import 'core-js/es6/date';
import 'core-js/es6/function';
import 'core-js/es6/map';
import 'core-js/es6/math';
import 'core-js/es6/number';
import 'core-js/es6/object';
import 'core-js/es6/parse-float';
import 'core-js/es6/parse-int';
import 'core-js/es6/regexp';
import 'core-js/es6/set';
import 'core-js/es6/string';
import 'core-js/es6/symbol';
import 'core-js/es6/weak-map';
import 'core-js/es7/array';
import 'core-js/es7/object'; // added import
.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)
It's also worth noting that only Node versions >= 7.0.0 fully support this.
http://node.green