Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
Can't access JS Object values by keys without storing in a variable

So, I ran into a weird bug in javascript.

const obj1 = await chartService.callAPIConversion({ unix_timestamp: Math.floor(activity[0].createdAt.getTime() / 1000) })

console.log(obj1.usd_rate);
//THIS WORKS -> returns proper value

console.log(await (chartService.callAPIConversion({ unix_timestamp: Math.floor(activity[0].createdAt.getTime() / 1000) })).usd_rate);
//THIS DOESNOT WORK -> returns undefined

Why am I not able to get the key without using a variable?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You're not able to access it without creating a variable because your are retrieving values from a JavaScript object not an API call. Once the JS object called obj1 gets the informations related to your API call you can now access these informations threw the call of your JS object.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda