Navigate back to the homepage

JavaScript Hoisting for dummies

Nomaan Ahgharian
April 30th, 2019 · 1 min read


What the hell is that? literal translation is “an act of raising or lifting something”. In javascript,

it refers to variable declaration moving up to top of their scope.

The key words here are: declaration and scope Without getting too technical, declaration is when you create a variable but don’t assign any value to it.

const, let, var are keywords used to declare a variable in javascript. They behave differently when it comes to hoisting.

Since functions are first-class citizens, they may or may not be hoisted.

If each red circle in the picture below is a balloon in a pool, we can see how they behave when it comes to hoisting.

hoisting illustration

More articles from Nomaan Ahgharian

How to format an SD card to FAT32 on a Mac without a virtual machine

An easy way to format your SD card to FAT32 format without having to use virtual box or any windows machine.

April 30th, 2019 · 1 min read

JavaScript Hoisting for dummies

What the hell is hoisting and what it is good for?

April 30th, 2019 · 1 min read
© 2019 Nomaan Ahgharian
Link to $ to $ to $ to $