I don't know how to emphasise how much closures are important 🙂 but if you are not aware of it, you may face many unpredictable and unexpected issues in your code. Even you are aware of it, you may still have some logical problem due to "Function Closure"Continue reading
Variables and constants declared with let or const are not hoisted!
In other words, a variable can be used before it has been declared.
Hoisting applies to variable declarations and to function declarations.
function declarations are hoisted before variable declarations.
A Function is much the same as a Procedure or a Subroutine, in other programming languages.
You can reuse code: Define the code once, and use it many times.
You can use the same code many times with different arguments, to produce different results.
- Function Declaration (function statement)
- Function Expression
- Function Constructor
- Self-Invoking Function (Immediately Invokable Function Expression IIFE)
- Arrow Function
- Object Method Shorthand Definition
- Generator Function