self executing function jquery vs javascript difference

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

What are the difference among -

First :-

(function () {

    var Book = \'hello\';

}());

Second:-

9条回答
  •  无人及你
    2020-12-02 20:56

    In fact, all three are self executing function's and ti really depends on what you are needing to do.

    The only difference between is between 3. 1 and 2 are the same.

    The difference with 3 is that you are passing a reference to jquery as an argument. Now all functions inside this annoyomus function have access to jque

提交回复
热议问题