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

157
Vistas
Different results came from different editor in terms of .this keyword

Everyone. I am learning javascript. I ran this code: (below)

function x(){
  return this;
}

console.log(x() === global);

in Atom editor, then got a result which was "false". (please see my added picture) However, I turned to another online editor to run the same code then got the result "true" ! (please see my added picture)

My question one is : Is it Atom's problem leading to different results ?

My question one two : I heard that "===" is named strict equality, which means it will be "false" if left operand is different with right operand. But, in the code I just have posted, in this line "(x() === global)", the result is "true" while the left operand and the right operand are certainly different, so what is wrong with it, is it that I am still not learning about some fundamental concepts?

Waiting for your answer Hopefully! enter image description here

enter image description here

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

0

in "sloppy mode" this keyword in a function refers to the global object. while in strict mode its value is undefined. I'm not sure about your editor's settings but I would say both are correct depending on the settings. It could be that atom sets strict mode by default while the other editor doesn't.

More on what is strict mode and what does it effect and why it is used for in MDN documentation

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