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

139
Vistas
How to change this js condition in a way that will ignore the 0 case in JS?

I have the following condition.

if (!product.tag_id) {
  return;
}

How can I change it in a way that for the tag_id which is equal to 0 it will not return wrong thing. Now it considers tag_id:0 as false value and returns nothing. How can be it fixed?

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

0

if (!product.tag_id && product.tag_id !== 0) return;
// Do something else

This checks for if the product tag id is not equal to zero before returning.

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