Deepak – 15-39 Aug 27

Hi, I'm unble to discrible but i need something like this insted of country.currency.symbol, i need country.USD.symbol. i want to have currency value and not as key beacuse every currency has different name in database.
UU
Unknown User600d ago
D
Deepak600d ago
this is the object that i need to access
"currencies": {
"PEN": {
"name": "Peruvian sol",
"symbol": "S/ "
}
},
"currencies": {
"PEN": {
"name": "Peruvian sol",
"symbol": "S/ "
}
},
@Timotius
UU
Unknown User600d ago
D
Deepak600d ago
no inside currencies you see "PEN"
UU
Unknown User600d ago
D
Deepak600d ago
this change for every country so i can't hard code it
UU
Unknown User600d ago
D
Deepak600d ago
here is my code
{Object.keys(country.currencies).map(
(currency, index) => {
return (
<span
key={index}
className="bg-lime-600 text-white px-1 rounded m-1"
>
{currency}
</span>
);
}
)}
{Object.keys(country.currencies).map(
(currency, index) => {
return (
<span
key={index}
className="bg-lime-600 text-white px-1 rounded m-1"
>
{currency}
</span>
);
}
)}
this gives me "PEN" but i want to go deeper and access symbol
UU
Unknown User600d ago
D
Deepak600d ago
in the above example i have currency as key but i am looking for way that i can access the value of currency and not as key if i do PEN.symbol it works but if i do currency.symbol it says undefined i don't know how to define this problem so i can google it
UU
Unknown User600d ago
D
Deepak600d ago
wait, i found the solution console.log(country.currencies[currency].symbol); 💪
UU
Unknown User600d ago
D
Deepak600d ago
i can't hard code pen. its different for every country for example for USA its USD
UU
Unknown User600d ago
D
Deepak600d ago
🧐 yes, problem is solve. 90% time it is solved as i explain it to others 😀 so your help count 🙏 by the way, can i reach you future if you are active on discord
UU
Unknown User600d ago
D
Deepak600d ago
okay, i willl just ask in reactiflux thanks
UU
Unknown User599d ago