Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

297
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda