Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

34
Views
How to add variable when i try to get object from objects

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"

7 months ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.