You can write this without any problem:
var x = function() {
// something
}
// avoid polluting global scope:
!function() {
// Some initialization.
}()