Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
How to map through array of objects to extract objects value?

i am trying to map through an array of objects to extract some value from each object.

When i run my code i am getting a result of undefined on console.log(open) but get all the data get log for the console.log(data)

Can someone tell me why is it undefined or what is wrong in my code?

thanks in advance

//Data from CCompare

CryptoCompareAPI.histoHour('BTC', 'USD')
.then(data => { 
  data = data.reverse()
  console.log(data)
  const open = data.map( d =>  d[3])
 
  console.log(open)

 
  tulind.indicators.sma.indicator([close],[3],(error,res) => {
     if (error) return log(error)
     console.log(res)
     })

  
  }
  //console.log("high",data[i].high)
  //console.log(data.length)
 
})
.catch(console.error())

Data

[{
    time: 1638356400,
    high: 57274.38,
    low: 56837.03,
    open: 57014.22,
    volumefrom: 761.03,
    volumeto: 43377564.28,
    close: 57193.03,
    conversionType: 'direct',
    conversionSymbol: ''
  },
  {
    time: 1638352800,
    high: 57212.91,
    low: 56897.87,
    open: 57144.92,
    volumefrom: 884.14,
    volumeto: 50454456.17,
    close: 57014.22,
    conversionType: 'direct',
    conversionSymbol: ''
  },
  {
    time: 1638349200,
    high: 57197.5,
    low: 56769.43,
    open: 56935.98,
    volumefrom: 1157.5,
    volumeto: 65981513.98,
    close: 57144.92,
    conversionType: 'direct',
    conversionSymbol: ''
  },
  {
    time: 1638345600,
    high: 57851.44,
    low: 56863.93,
    open: 57169.38,
    volumefrom: 2238.66,
    volumeto: 128240428.38,
    close: 56935.98,
    conversionType: 'direct',
    conversionSymbol: ''
  },
  ... 90 more items
]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const data = [{
    time: 1638356400,
    high: 57274.38,
    low: 56837.03,
    open: 57014.22,
    volumefrom: 761.03,
    volumeto: 43377564.28,
    close: 57193.03,
    conversionType: 'direct',
    conversionSymbol: ''
  },
  {
    time: 1638352800,
    high: 57212.91,
    low: 56897.87,
    open: 57144.92,
    volumefrom: 884.14,
    volumeto: 50454456.17,
    close: 57014.22,
    conversionType: 'direct',
    conversionSymbol: ''
  },
  {
    time: 1638349200,
    high: 57197.5,
    low: 56769.43,
    open: 56935.98,
    volumefrom: 1157.5,
    volumeto: 65981513.98,
    close: 57144.92,
    conversionType: 'direct',
    conversionSymbol: ''
  },
  {
    time: 1638345600,
    high: 57851.44,
    low: 56863.93,
    open: 57169.38,
    volumefrom: 2238.66,
    volumeto: 128240428.38,
    close: 56935.98,
    conversionType: 'direct',
    conversionSymbol: ''
  },
]

const open = data.map(e => e.open)
console.log(open)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!