JavaScript Object.values()
Example
const person = {
firstName : "John",
lastName : "Doe",
age : 50,
eyeColor : "blue"
};
let text = Object.values(person);
Try it Yourself »
Description
The Object.values()
method returns an array of the property values of an object.
The Object.values()
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 types.
The methods above return an Iterable (enumerable array).
Iterables makes it simpler to use objects in loops and to convert objects into maps.
Syntax
Object.values(object)
Parameters
Parameter | Description |
object | Optional. An object. |
Return Value
Type | Description |
Array | An iterable array of the object's property values. |
Browser Support
ECMAScript 2017 added the Object.values()
method to objects.
Object.values()
is supported in all modern browsers since March 2017:
Chrome 54 | Edge 14 | Firefox 47 | Safari 10.1 | Opera 41 |
Oct 2016 | Aug 2016 | Jun 2016 | Mar 2017 | Oct 2016 |