Home > Software engineering >  How to retrieve the value of the first field in an object without its name?
How to retrieve the value of the first field in an object without its name?

Time:10-30

I am using the REST Countries API to retrieve data from different countries, the point is to generate a HTML code to insert, depending on the country data.

But as I'm trying to point the language data in my HTML code, it of course returns me an object.

Here are two examples of the data from the API:

languages: {cat: 'Catalan'}
languages: {fra: 'French'}

The line of code in my HTML:

<p ><span>           
  • Related