The main difference between global and local variables is where they can be used in the program. Using a variable globally means that it WILL suffer changes everytime its value changes, whether this happens inside or outside a function. It is declared inside the script tags but outside any function. Local variables can only be used inside the function they were created in and WILL NOT be recognised outside that specific function. Be careful with nested expression too, because a variable declared inside a nested expression can only be used from the place in was declared in inwards, but not outside the first expression.