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β’3y ago
Message Not Public
Sign In & Join Server To View
this is the object that i need to access
@Timotius
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
no inside currencies you see "PEN"
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
this change for every country
so i can't hard code it
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
here is my code
this gives me "PEN" but i want to go deeper and access symbol
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
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 itUnknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
wait, i found the solution
console.log(country.currencies[currency].symbol);
πͺUnknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
i can't hard code pen. its different for every country for example for USA its USD
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View