JavaScript Object.values()

Definition and Usage

Object.values() The method returns an array containing the object property values.

Object.values() The method does not change the original object.

Related Methods:

Object.keys() Returns the keys (properties) of any object type.

Object.values() Returns the values of all object keys (properties).

Object.entries() Returns the keys and values of any object type.

The above methods return iterable objects (enumerable arrays).

Iterables make it easier to use objects in loops and convert objects to Map.

Instance

const person = {
  firstName: "Bill",
  lastName: "Gates",
  age: 50,
  eyeColor: "blue"
};
let text = Object.values(person);

Try It Yourself

Syntax

Object.values(object)

Parameter

Parameter Description
object Optional. Object.

Return Value

Type Description
Array An iterable array containing object property values.

Browser Support

ECMAScript 2017 adds to objects Object.values() Method.

Starting from March 2017, all modern browsers support Object.values():

Chrome Edge Firefox Safari Opera
Chrome 54 Edge 14 Firefox 47 Safari 10.1 Opera 41
October 2016 August 2016 June 2016 March 2017 October 2016