4 Habits to Avoid Bugs related to Hoisting in your JavaScript Code
Declaring variables at the beginning of the scope
By declaring variables at the beginning of the scope you ensure that these variables are accessible throughout that scope, avoiding any confusion caused by hoisting.
const data = 12;
const variable = ...
shubhsharma19.hashnode.dev2 min read