Bind a function accepting three arguments and accepts the middle one

Viewed 39

I have a function with three arguments

function funcy(arg1, arg2, arg3){
   return (arg1+arg3)*arg2
}

I can bind this as follows

const funcybound = funcy.bind({}, 1/*arg1*/, 2/*arg2*/)
funcybound(3);//arg3
 

Is there any way to create a bound function such that it accepts the middle argument, fixing the first and last in place

Maybe something like this

const funcybound = funcy.bind({}, 1/*arg1*/,null, 2/*arg3*/)
funcybound(2);//arg2

I know i can return a function that does this, but just curious if i can do this with just the bind method

0 Answers
Related