JavaScript: Variable Scope [ includes scope chain and const scope ]
Understanding the scope of a variable is really a critical part of learning JavaScript. By using the variable in a place where it is not available will throw errors and/or introduce bugs. Scope of the variable defines- in which part of the code the variable will be available.