Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

297
Vistas
how to pass argument to multiple lambda expressions in javascript?

can i give 2 argumens if there is multiple lambda funcionts in javascripts? i have the following code

var twice = (x) => {
  return x *x;
}

var lambda = (b) => { 
  (a) =>{
    return b(b(a));
  }
}; 


console.log(lambda(twice, 5));

this wont work, and I could use

  var lambda = (b,a) => { 
        return b(b(a));
    }; 

and will work, but can I use separate lambda expression and give them arguments ?

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can forward arguments to a function like this:

const twice = x => x * x;

const invokeFunctionWithArgs = (fn, ...args) => fn(...args);

console.log(invokeFunctionWithArgs(twice, 5)); // 25

about 4 years ago · Santiago Trujillo Denunciar

0

Yes, You would take advantage of closures so that the inner function returned from invoking lambda() can keep a reference to its surrounding lexical environment.

You then call said inner function with the desired value lambda(twice)(5), in this case, 5.

var twice = (x) => {
  return x *x;
}

var lambda = (b) => { 
  return (a) => {
    return b(b(a));
  }
}; 


console.log( lambda(twice)(5) ); // -> 625

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda