Web programming: the immediately invoked function expression (IIFE)

Self-tutoring about web programming: the tutor brings up IIFE.

It’s been my experience that a function need be called to run, but perhaps not always. Apparently, in JavaScript, the construction

(function(){
//
function code lines
//
})();

will run spontaneously.

I’ve tried it with success:)

Source:

mozilla.org

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply