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
Post a Comment