Closing scope in Node

In an express app I am able to do this

function donothing() {
}
donothing()

but not this

(function donothing() {
})()

The second sample fails with

TypeError: undefined is not a function

Why is that?

with ; your code work correctly.

instead

 (function donothing() {
})()

use

;(function donothing() {
    })()