It looks like those are the arguments to a function call, ie
foo(j, function() {
alert(1);
})
That will pass the current value of j
as the first argument, and the function listed there as the second argument.
That said, in order for that function—the one that alerts 1—to be called, foo
would have to manually call it. Something along the lines of
function foo(j, f){
f();
}
EDIT
So, per your question edit, it looks like what's above is more of less correct, except instead of referencing the function directly, you're fetching it from an eval statement.
Something like this:
function foo(j, f){
f();
}
var s = "foo";
var j = 0;
eval(s)(j, function() {
alert(1);
})
Here's a working FIDDLE