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

260
Vistas
Is there an operator for comparing undefined or null types?

Sorry if the title made it unclear, but I've been wondering, is there an operator for comparing types like null and "null"?
We all know that:
"1" == 1 returns true.
and
"1" === 1 returns false.
But when I try to do something like:
undefined == "undefined", for me, it returns false, even though I am not using ===.
Why does this occur? Is there an operator for comparing undefined and "undefined", or null and "null"?, etc...

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

0

In answer to the question in the title, no there isn't - JavaScript does not generally examine the semantic content of strings - "use strict" placed at the beginning of code to invoke strict mode execution is the exeception.

Note that the typeof operator is a convenience operator which does not return the data type of its operand in all cases - function objects are of (JavaScript) data type "Object", and null is of (JavaScript) data type "Null".

"undefined" is a string value with specific content. It is not equal to undefined (the one and only value with data type "Undefined") or null (the one and only value with data type "Null").

There is however an automatic type conversion between null and undefined which causes the non-strict equality operator to treat them as being equal, often used with a negation operator:

 if( value != null) {
     // proceed knowing value isn't `undefined` or `null
 }
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