javascript - Passing a function with parameters -


i want pass function parameters function without evaluating it.

this method doesn't work:

function first (id) {...}  function second (func) {     func(); }   second(first(id));  

this method can't use because number of parameters not same:

function first (id) {...}  function second (func, id) {     func(id); }  second(first, someid); 

you can use #bind partial application:

second( first.bind(null, id) ) 

Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -