0
var Product = (function () {
    function Product() {
    }
    return Product;
}());

For example note the above function, It is creating a IIFE function inside that another function is created outside, it is returning that empty function. And i need a clear process of IIFE.

georgeawg
  • 46,994
  • 13
  • 63
  • 85
  • Also relevant https://stackoverflow.com/questions/592396/what-is-the-purpose-of-a-self-executing-function-in-javascript https://stackoverflow.com/questions/1140089/why-do-you-need-to-invoke-an-anonymous-function-on-the-same-line https://stackoverflow.com/questions/2421911/what-is-the-purpose-of-wrapping-whole-javascript-files-in-anonymous-functions-li https://stackoverflow.com/questions/26092101/what-is-this-javascript-pattern-called-and-why-is-it-used – VLAZ Jan 23 '20 at 19:02
  • 2
    "I need a clear process of IIFE" What is unclear about the resources you have already read about this subject? –  Jan 23 '20 at 19:03
  • An IIFE is exactly what it is named. An immediately invoked functional expression. The logic is written such that, immediately after the function is declared, it is invoked. What that function does within its body is a secondary thing with regards to what an IIFE is. – Taplar Jan 23 '20 at 19:04
  • https://en.wikipedia.org/wiki/Immediately_invoked_function_expression – georgeawg Jan 23 '20 at 19:08
  • Your question essentially boils down to: "I don't understand." And "I don't understand" isn't really an answerable question. Take the code you have an examine it. Tinker with it. Modify it and see how the behavior changes. Basically... *try*. For example, after you execute this code what does `var Program` contain? What do you expect it to contain? Why? As you make modifications to the code, what changes about the behavior or result? This is how you learn things. – David Jan 23 '20 at 19:10
  • @Taplar It is not "immediately invoked functional expression". It is "immediately invoked function expression". – Ben Aston Jan 23 '20 at 19:12

0 Answers0