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

244
Vistas
Ternary Javascript for HTML (Angular)

how can I change the following to ternary so I can use it in .HTML file

if (statusChange && statusChange === 'Employed') {
  return true;
} else {
  return employmentStatus === 'Employed'
}

i.e. assign the result of the second comparison only if the first if statement results to false

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

No need for ternary operation here, just use the or operation:

statusChange === 'Employed' || employmentStatus === 'Employed'

If the first part is true, the whole expression will return true. If it's false, it will check it the second part is true or false

Much cleaner

about 4 years ago · Juan Pablo Isaza Denunciar

0

Simply:

return statusChange && statusChange === 'Employed' ? true : employmentStatus === 'Employed'
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