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

182
Views
Arrow Function Created In An Object Returns undefined When Called Using .call() Method

i just created an object with an arrow function :

const user={
    fName:"0xN1nja",
    about:()=>{
        return this.fName;
    }
}

now, when i call that arrow function with .call() method, it returns undefined :

a=user.about.call(user);
console.log(a);
>>> undefined

But when i replaced that arrow function with a normal function expression, it returns the value

const user={
    fName:"0xN1nja",
    about:function(){
        return this.fName;
    }
}
a=user.about.call(user2);
console.log(a);
>>> 0xN1nja

what is happening here?

PS : im new to javascript

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Arrow functions don't bind to this as function do. That's one of the main reason they were introduced (probably the most important one).

You cannot even bind them.

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!