In simple words, hoisting allows one to use variables and call functions before they’re even declared. This concept is absolutely essential to understand for a beginner. If not understood, this can cause unwanted bugs in your code!
Note: Only declarations are hoisted and not initializations.
In this article, I will be writing about how hoisting works for functions. I have already written about how hoisting affects the usage of var, let and const in my article Difference between var, let and const.
Therefore I would not be going into details for the same. Nevertheless, here’s the summary: