JavaScript Object.values()
- Previous page valueOf()
- Next page assign()
- Go back to the previous level JavaScript-Objektreferenzhandbuch
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 to convert objects to Maps.
Instance
const person = { firstName: "Bill", lastName: "Gates", age: 50, eyeColor: "blue" }; let text = Object.values(person);
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.
Since 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 |
- Previous page valueOf()
- Next page assign()
- Go back to the previous level JavaScript-Objektreferenzhandbuch