The first two are something called a function expression, meaning it is built-in and interpreted as JS code.
The third is a function declaration and is interpreted when compiling the code. Since it is interpreted during compilation, you cannot run it immediately, since none of the other codes around it are running.
To show an example:
// foo == undefined // bar == function function bar(){ .. } var foo = function(){ ... } // foo == function // bar == function
Simply put, anytime you have a word function
without anything preceding it, it is an ad. At any time, something precedes him, this expression.
Mark Kahn Jul 16 2018-11-17T00: 00Z
source share