Please explain what is the difference of function declarations.

var func = function(){ //some code } и var func = (function(){ //some code })(); 

    1 answer 1

    In the first case, we only define the function and write it into the func variable. You can then use func() to call the function.

    In the second case, we define the function and immediately call it, and the response is written to the variable func .