examples without brackets:
void function (msg) { alert(msg); }
('SO');
(this is the only real use of void, afaik)
or
var a = function (msg) { alert(msg); }
('SO');
or
!function (msg) { alert(msg); }
('SO');
work as well. the void
is causing the expression to evaluate, as well as the assignment and the bang. the last one works with ~
, +
, -
, delete
, typeof
, some of the unary operators (void
is one as well). not working are of couse ++
, --
because of the requirement of a variable.
the line break is not necessary.