Functional scope vs global scope

What is the difference between functional scope and global scope?

1 Like

variables are ’ function scope . … It means they are only available inside the function they’re created in, or if not created inside a function they are ’ globally scoped. ’ If var is*defined inside a function and I subsequently try to call it outside the function it won’t work.

1 Like

Functional scope means variables only accessible within a function and not outside of it.
Global scope means variables accessible anywhere , outside or inside function.

Imagine the fridge in your house is accessible to everyone. Even an unwanted guest uses it. But your cupboard can only be used by you because it is in your room and people are forbidden to go to your room.

4 Likes