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

278
Visualizações
Evaluating text or string in Javascript

I have a React app and I have a dictionary of symbols stored in another file in the form of securities.{asset}.symbol. For example, for Apple stock the address is stored at securities.Apple.symbol which normally evaluates to 'AAPL'.

So,

    let bb = `securities.${asset}.symbol`;

bb is now a string 'securities.Apple.symbol' How do I evaluate the string above instead of returning a string?

I have tried

 let re = Function('return ' + bb)();
 console.log('res', re));

However that console.log doesnt return anything... (whereas if

  let bb=`1+1` 

it would work and evaluate as 2)

Do you have a solution? Thanks

about 4 years ago · Juan Pablo Isaza
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