* Function declaration: A function declaration creates a function that you can call later in your code.
* Function expression: If you put a function where the interpreter would expected to see an expression, then it is treated as expression(aka function expression). In function expression, the name is usually omitted.
* What's the difference of usage between function declaration and function expression?
** The interpreter always looks for variables and function declarations before going through each section of a script, line-by-line. This means that a function created with a function declaration can be called before it has been declared. In function expression, the function is not processed until the interpreter gets to that statement. This means you cannot call this function before interpreter has discovered it.
* IFFE = immediately invoked function expressions
没有评论:
发表评论