Rationale for KM JavaScript-in-browser style: enclose in (function () { ... } )();

The first example I used from the late JMichaelTX for a The JavaScript text in front browser condition was in this form:

(function ()( {
    // .... JavaScript code ...
    return theReturnValue
}
)();

as opposed to

// .... JavaScript code ...
theReturnValue

What would be the rationale for the self-executing function () format?

See the step by step account of the various parts of an IIFE in this post:

3 Likes