self executing function jquery vs javascript difference

后端 未结 9 819
长发绾君心
长发绾君心 2020-12-02 19:59

What are the difference among -

First :-

(function () {

    var Book = \'hello\';

}());

Second:-

9条回答
  •  不知归路
    2020-12-02 20:45

    These all are self executing functions. Now days also known as Immediately Invoked Function Expressions (IIFE).

    First two are exactly same with slightly different syntax and third is passing a parameter as jQuery object.

提交回复
热议问题