JavaScript (ES2026) reference · Object Methods

JavaScript Object.values() Method

Return an array of an object's own enumerable property values, in the same order as Object.keys().

JavaScript (ES2026) Since ES2017

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

Object.values(obj)

Parameters

ParameterDescription
obj The object to inspect or change.

Return value

An array of values.

Examples

List the valuesTry it yourself
const scores = { ada: 92, linus: 85, grace: 97 };
console.log(Object.values(scores));

Output

[ 92, 85, 97 ]
Sum the valuesTry it yourself
const cart = { tea: 3, cake: 4.5, milk: 1.2 };
console.log(Object.values(cart).reduce((sum, p) => sum + p, 0));

Output

8.7

Version history

VersionChange
JavaScript ES2017Added

In other languages

Was this page helpful?