Get the value of the first object property using Object.values() and array destructuring.

const obj = {
  myKeyA: 'my value A',
  myKeyB: 'my value B',

const [valueOfFirstObjectProperty] = Object.values(obj)

console.log('Value:', valueOfFirstObjectProperty) // my value A

See example online at

Did you find it interesting? Follow me on Twitter.

Categories: snippet


Leave a Reply

Your email address will not be published. Required fields are marked *