Hoisting in JavaScript

Hoisting in JavaScript

Function hoisting

Here the functions are moved to the top of their scope, so that they can be used further. But here are some exceptions in javaScript where the function hoisting doesn't works

No alt text provided for this image

Cases where hoisting doesn’t works:

1.When function is written inside the parentheses

No alt text provided for this image

2. In function expressions

No alt text provided for this image
No alt text provided for this image

3. In the arrow functions

No alt text provided for this image

Variable Hoisting

No alt text provided for this image
No alt text provided for this image

So, this is how the concept of hoisting works in javaScript!



Akash Agarwal

Software Engineer III @ Oracle Cerner Corporation

3y

Thanks for sharing 👍

Like
Reply

To view or add a comment, sign in

More articles by Karishma Gajria

Insights from the community

Others also viewed

Explore topics