In JavaScript, hoisting is a phenomenon in which variable and function declarations are moved to the top of their respective scope, either global or local. This mechanism may appear confusing at first ...
Understanding Hoisting requires a good understanding of scopes in JavaScript. So we will be starting with scopes.