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

137
Views
Benefits of this unusual pattern for calling a function

I encountered the following pattern for calling a function in a library. Code is

(0,library.method)('value');

I assume that using it has something to do with scope and this value

function a(v){
  console.log(this);
  console.log(v)
};

const b ={};
b.a=a;

b.a('test') // _this_ is object b
(0, b.a)('test') // _this_ is window

What is the syntax of adding the 0, & why would someone choose this syntax? i have never encountered this before.

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!