Learning hoisting in Javascript? Don't just read - DO! With these 11 Hoisting Problems.
When I was learning hoisting, I really just wanted to poke around at problems until I understood what was going on.
The issue? No one had coallated a set of hoisting examples that covered all features and edge cases of this concept.
This repo is build to cover ALL edge cases and concepts so that a beginner can go from hosting noob to expert in just one set ofproblems.
Copy all the problems from main.js into your IDE with a good terminal OR a tool like Javascript Replit
Then, one problem at a time - make a prediction on WHAT you think will be logged by the function.
After you make a prediction, comment out the function call, and run the code!
If your prediction was correct - great! Next problem.
If your prediction was incorrect - STOP, learn more about hoisting, and don't continue until you are able to explain WHY the code does what does.
Do you know some hoisting edge cases that are unaddressed by this problem set?
Please make a Pull Request and I'll be happy to add :)
Shout out to Bhuvan Malik for being the source of many of these hoisting problems! Check out his excellent article here.