JavaScript has two scopes -C global and local. Any variable declared outside of a function belongs to the global
scope, and is therefore accessible from anywhere in your code. Each function has its own
scope, and any variable declared within that function is only accessible from that function and any nested functions.
read more >>