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

160
Vistas
Shorthand if/else statement without assign

Is there any way to shorthand a block like this?

if (popupIsvisible === false) {
    this.show();
} else {
    this.hide();
}

I've tried:

popupIsvisible === false? this.show() : this.hide();

but I get the error below:

Expected an assignment or function call and instead saw an expression

I don't want to assign to something just execute the hide/show depending on popupIsvisible.

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

0

The answer to your question is no! there is no way to do that as you want

but you you can just do this however I see no point doing that

if (popupIsvisible) this.show();
else this.hide();
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