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

158
Vistas
'this' in JavaScript behaves differently in node and chrome console

running the same code in different environments produces different results1

try running the code below in chrome console and on node js, the first produces snehal snehal and the other undefined undefined

this.name = "snehal";

function meme() {
  console.log(this.name);
  function mem() {
    console.log(this.name);
  }
  mem();
}

meme(); 

The basic idea about this in JavaScript is that it points/refers to the object that contains it, so in the chrome console we can expect the inner mem function this to be === to the meme function this, but the same is not consistent in the node environment.

about 4 years ago · Juan Pablo Isaza
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