This is often called a Self-Invoked Anonymous Function or Immediately Invoked Function Expression (IIFE). It is a function that executes automatically when you create it, and has the following form:

    // some private code that will be executed automatically
    var result = a+b;
    return result;

Leave a Reply

Your email address will not be published. Required fields are marked *