Is there a more concise way to convert an object's properties' values into an array of those values?

Is there a more concise way to convert an object's properties' values into an array of those values?
0

#1

Let’s say I have the following object:

const coords = {
  lat: 36,
  lon: -100
}

My main goal is to create another object (finalObj) having a property named coordinates which is an array containing the lat and lon properties’ values.

I know I can write the following to accomplish this:

const {lat, lon} = coords;
const finalObj = {
  coordinates: [lat, lon]
}
console.log(finalObj.coordinates) // displays [36, -100]

and can also write the following to accomplish this:

const finalObj = {
  coordinates: [...Object.values(coords)]
}
console.log(finalObj.coordinates) // displays [36, -100]

The Question: Is there a more concise way of writing the last version without using the Object.values method? I was hoping to use destructuring in some way without having to rely on an extra step (as seen in the first way). Any suggestions would be great.

Thanks in advance.