global vs local variables in javascript #youtubeshorts #SHORTS
global and local variables in #javascript
.
.
Let’s compare them with groceries 😂🤣 seems like you all really enjoy my silly food examples. Well ima make more of that. I love comparing everything with food anyways 😂😂
.
➡️Global variables are declared outside any function, and they can be accessed (used) on any function in the program.
➡️compare that like your mamas groceries. Everyone in the family can grab it. It’s almost like a first come first serve 😅😅😅
➡️Local variables are declared inside a function, and can be used only inside that function. It is possible to have local variables with the same name in different functions.
➡️compare that to your own groceries in the fridge. It’s yours and no one supposedly should take them from you 😂😂😂👏🏼🙌🏽 well unless you love to share 😝😛
#learntocode #programming #webdevelopment