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

213
Visualizações
boolean function: check whether first expression is executed or the second

I have a boolean return from a function which suggests 2 checks and according to the result a message is displayed

example:

<script>
function guessTheNumber(p1) {
  const test = 5;
  return p1 > 6 || p1 === test ;
}
</script>

displayed text

{{ greater (if first expression is executed) || {{ equal (if second expression is executed) }}

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

0

These conditions can be expressed in the markup...

{{ p1 > 6 ? 'greater than 6' : (p1 === 5 ? 'equal to 5' : 'neither' ) }}

Or, the way I prefer, in a method that's understood to produce a string for the markup...

<!-- in the markup -->
{{ theThingAboutP(p1) }}

// in methods: {}
theThingAboutP(p1) {
  if (p1>6) return 'greater than 6';
  if (p1===5) return 'equal to 5';
  return 'neither';
}
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