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

164
Views
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 answers
Answer question

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 Report
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!