Understand programming II - Variable privacy
Last time i was speaking about variables. This time i will talk about variable privacy. Let's start.
So, last time we imagined variable as a box.
Now, variable privacy in JavaScript is to default set to local. It can also be global. Imagine now our variable as a box called "Variable" and it is set to local, imagine also that our function(since it is used just in functions(i will talk about them in next post sorry i didn't have time)) is a truck.
If our box(variable) is set to local and it is in the truck it means it cannot be used in another truck. That means the variable exists only when it is used in function it is declared in.
Now, imagine global variables are boxes that are outside the truck. Since it is outside it can be put in any truck(function on peace of code).
Next time i will talk about functions and their use. Until next time bye o/
noice hope to see more
Thanks for support parkerxvega, i plan to do 10 parts but if you request more i will do more :)
haha this is parker speaking, vega is my girlfriend but YEA totally im lovin it man i wanted to learn this anyways and this makes sense .
Thanks for support you two :)