Javatpoint Logo
Javatpoint Logo

JavaScript Hoisting

Hoisting is a mechanism in JavaScript that moves the declaration of variables and functions at the top. So, in JavaScript we can use variables and functions before declaring them.

JavaScript hoisting is applicable only for declaration not initialization. It is required to initialize the variables and functions before using their values.

JavaScript Hoisting Example

Here, we will use the variable and function before declaring them.

JavaScript Variable Hoisting

Let's see the simple example of variable hoisting.

JavaScript Function Hoisting

Let's see the simple example of variable hoisting.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA