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

293
Views
How do I embed the values of the arguments in JavaScript's Function.prototype.toString?

I need to get a string representation of a function, with its corresponding values of arguments.

Imagine the following statement:

const r1 = (x) => abc(x, 2);

Executing r1.toString() would give a string "x => abc(x, 2)".

Now, imagine I modify the previous piece of code like this:

const create = y => (x => abc(x, y));
const r2 = create(2);

Although r1 and r2 are equivalent in terms of the execution (they will both call abc, passing 2 as the second argument), the string representation will be different. In fact, r2.toString() will now give "x => abc(x, y)".

How do I modify either the create function ro the r2.toString() to have the same output as r1.toString()?

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!