Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

214
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda