JavaScript variables lifecycle: why let is not hoisted

Hoisting is the process of virtually moving the variable or function definition to the beginning of the scope, usually for variable statement var and function declaration function fun() {...}. When let (and also const and class, which have similar declaration behavior as let) declarations were introduced by ES2015, many developers including myself were using the hoisting definition to describe how variables are accessed. But after more… Continue reading

JavaScript variables hoisting in details

Variables in a program are everywhere. They are small pieces of data and logic that always interact with each other: and this activity makes the application alive. In JavaScript an important aspect of working with variables is hoisting, which defines when a variable is accessible. If you're looking for a detailed description of this aspect, then you're in the right place. Let's begin. 1. Introduction… Continue reading