Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
'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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!