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

250
Vistas
What's the difference between ( ' ' || false) and (false || ' ' ) in JavaScript?

In developer.mozilla website there are some examples to show different usage of logical OR operator, but this two examples got my attention, here they are :

o8 = ''    || false      // f || f returns false
o9 = false || ''         // f || f returns ""

Why this two, return different results? I expected both of them return false.

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

See in the same page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR

expr1 || expr2

If expr1 can be converted to true, returns expr1; else, returns expr2.

about 4 years ago · Santiago Trujillo Denunciar

0

All variables are falsy, so during each evaluation, because the first operand (left side) is coalesced to a falsy value, the operand on the right side of the || will be used.

about 4 years ago · Santiago Trujillo 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