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

152
Visualizações
Functions not executing in ternary operator

I tried this in my code and also in the Chrome console and it's not doing what I want. Do you know why it's not working?

let r = 'd';
r == 'e' ? console.log('itisE') : 
r == 'd' ? console.log('itisD') : console.log('nothing');

Chrome's console prints "undefined", it doesn't execute the function calls. Neither does my code (in my code, it's for UI changes of various buttons).

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

0

I assume that you are talking about in the google chrome browser -> developer tools and then the console inside them.

the console works in a way that it has to return/print any value to you, in this case, the let r = 'd' its not printing anything, for that reason shows undefined; becasue the console always does a Console.log() on the background.

and when you assign a value you are not really printing/returning anything, thats why you see undefined;

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