Scope is a part of a program within which a variable is available for use. When creating🏗️
.js file, we create🏗️ the scope of the whole file to create🏗️ the internal scope , you must declare it with curly braces
In this example, we have created🏗️ three variables in different scopes, which have their own version of the
fruit variable, so no errors🙅♂️ occur, but if you try to create🏗️ two variables with the same name in the same scope, an error will occur🙅 ♂️.
When creating🏗️ various constructs, you also create a scope for that construct, since you use a block of curly braces
In these examples, each construct has its own scope.
Thanks goes to these wonderful people (emoji key):
🐛 🎨 🖋
🖋 🐛 🎨