- Global if defined outside any function
- Local to function and all nested function , if defined in function
Namespace can be created as following,
You see that to create namespace you need to start parenthesis and then put a function inside that as shown in above image. Now every variable you define under this function will have scope in this block of code only.
The other way you can create Namespace as given below,
And you can execute GetData() function as follows ,