Skip to content
Advertisement

Get value from array key and build a new array

I cannot get the value of ‘Date’ key to build my array.

JavaScript

The console shows this output:

JavaScript

Seems like the problem is with Object.keys(o)[0]. How can I fix this?

Advertisement

Answer

You actually want the first value, not the first key.

JavaScript

However, since you already know the name of the key, you can simply use o.Date.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement