0

Good afternoon

How can i use variable when i try to get object from objects here is my array:

let coinsArr = [{
    "id": "bitcoin",
    "name": "Bitcoin",
    "symbol": "BTC",
    "checked": true
},
{
    "id": "ethereum",
    "name": "Ethereum",
    "symbol": "ETH",
    "checked": true
}]

here is my objects

let coinsObj = {
 "BTC": {
   "USD": 49220.39
 },
 "SOL": {
   "USD": 186.6
 }

to calling to some object i have to do "coinsObj.BTC.USD"

my question is how can i change the "BTC" between coins."to".USD instead of some variable like "coinsObj.coinsArr[0].symbol.USD"

0 Answers0