DEV Community

Domnic Omondi
Domnic Omondi

Posted on

Hoisting in Javascript

Hoisting is the ability of javascript interpreter to call functions,variables or classes before they appear in the code or before execution of the code.
Hoisting allows you to use functions, variables or classes before declaring them.

example with Hoisting
Image description

How you would write the same code without HOISTING

Image description

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay