Object.values()

Returns an array of an object's own enumerable property values.

Since ES2017 Spec ↗

Syntax

Object.values(obj)

Parameters

NameTypeRequiredDescription
obj object Yes The object whose enumerable own property values are returned.

Returns

Array — An array of the own enumerable property values.

Examples

console.log(Object.values({ a: 1, b: 2 }));
Output
[ 1, 2 ]
console.log(Object.values({ x: 'a', y: 'b' }));
Output
[ 'a', 'b' ]

Notes

Order matches `Object.keys`. Only own enumerable string-keyed values are included. Combine with `reduce` for quick aggregation.

Browser & runtime support

EnvironmentSince version
chrome 54
firefox 47
safari 10.1
edge 14
node 7.0

See also