If you have followed my previous posts, the editor i am using is VSCode with some extensions installed. If you have missed it, please follow the below link:
I am extensively using Quokka and Better comments plugins in VSCode to communicate the things.
//* — i am using this to highlight what exact operation i am trying to perform.
//! — i am using this to highlight language specific pitfalls and trying to highlight how it works.
Also the values in blue showing up towards the end in the below image is the output.
Just to re-iterate, the goal here is that visualising the below image anyone should be able to:
- Understand the concept.
- Know how to code the concept.
- Know how the output varies based on the code.
As description variable was not found in scope of function x, it went up to it’s next higher scope(global in this case) and found it. If it was not declared, it would have thrown Reference Error: description is not defined.
Types of Declaration:
More can be found in:
The var statement declares a variable, optionally initializing it to a value.developer.mozilla.org
Code for this can be found here:
GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over…github.com
If you found this helpful, please 👏 and share this using links below.