i’m trying to get the value of a Object in my array. Basically when i’m doing
var firsts = response.data; console.log(firsts)
I have something like that
{ "EUR_BND": 1.603476 }
But the name of the object is changing every time, so i can’t do
response.data.EUR_BND
I wondered if there was a way to directly get the value of the only object, without having to go through its name.
Advertisement
Answer
You can use the object.values
Object.values(response.data)
Which would return an array of the values in the object
Object.values(response.data)[0]
would return the value if you have one