function foo(b)
{
return cool
(
function(x)
{
if(x)
{
b(x);
}
}
);
}
where cool is a function that takes in a function. This code works well enough. How can I make this work though?
function bar(x)
{
if(x)
{
b(x);
}
}
function foo(b)
{
return cool(bar);
}
I want to do this because bar is a frequently used function from functions that are like foo. Is there any way to open up the scope further so that bar can see b from foo?
coolfunction. Oh well it was worth asking.cool. Take a look at Daniel's answer below.