Init function in javascript and how it works

前端 未结 7 1870

I often see the following code:

(function () {
  // init part
})();

but I never could get my head around how it works. I find the last brac

7条回答
  •  不知归路
    2020-12-02 06:39

    Self invoking anonymous function (SIAF)

    Self-invoking functions runs instantly, even if DOM isn't completely ready.

    jQuery document.ready vs self calling anonymous function

提交回复
热议问题