JavaScript Hoisting Explained

Did you ever wondered why you were able to invoke functions before the declaration of the function in your code? That's the magic of JavaScript Hoisting. We know that JavaScript is a interpreted language and the codes get executed from top to bottom, line-by-line in order. Well, that's true for most cases except variables and function declarations statements. JavaScript interpreter pre-processes all variables and function declarations statements and hoist (move up) them to top their respective scope and then the…

Continue Reading
Close Menu