Deepak
Deepakβ€’3y ago

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.
19 Replies
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y 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
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y ago
no inside currencies you see "PEN"
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y ago
this change for every country so i can't hard code it
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y 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
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y 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
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y ago
wait, i found the solution console.log(country.currencies[currency].symbol); πŸ’ͺ
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y ago
i can't hard code pen. its different for every country for example for USA its USD
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y 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
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Deepak
Deepakβ€’3y ago
okay, i willl just ask in reactiflux thanks
reactibot
reactibotβ€’3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1013110504186720317