Scope In JavaScript

Scope is the accessibility of variables, functions, and objects in some particular part of your code during runtime. In other words, scope determines the visibility of variables and other resources in areas of your code.(1)

In JavaScript if we declare variable outside of a function and want to use this variable inside the function, it runs greatly. Below picture is an example for that.