You should xactually have a function, and you should actually call it:
function test(x) {
x();
}
test(function() { alert("Hello World!"); });
Itself alert("Hello World!")is just an expression, not a function. The only way to syntactically turn an expression into a function (without immediately evaluating it, at least) is to syntax the syntax of this function above.