Home > Blockchain >  How do I select Object like an array?
How do I select Object like an array?

Time:12-01

I am trying to select currencies[0].name but since it's not an Array I can't do that. What's the best way to select it? Do I need to convert it into an array and store it into a variable? In that case, I would need to empty the array every time I render a new country via function.

Now I can only select it by data.currencies.EUR.name but when the currency changes from EUR it doesn't work anymore. What do you suggest to do?

const renderCountry = function (data) {
  const html = ` <article >
    <img  src="${data.flags.png}" />
    <div >
      <h3 >${data.altSpellings[2]}</h3>
      <h4 >${data.region}</h4>
      <p ><span>           
  • Related