Attached the wrong screenshot, I was playing around with the function example as well, which I mentioned too. Mistake on my end. Thank you for correcting!
No problem, happy to help, also i forgot to mention, in the quote at the end, the variable names have to the same in that example to give a syntax error, however it wouldn't be shadowing effect anymore, as they become part of the same scope.
The example code and the output that you have given seems to be of two different examples, the output if no functions are involved, should be
Also if you add an example of a function and show how the value of var does not change, that might help too.
Attached the wrong screenshot, I was playing around with the function example as well, which I mentioned too. Mistake on my end. Thank you for correcting!
No problem, happy to help, also i forgot to mention, in the quote at the end, the variable names have to the same in that example to give a syntax error, however it wouldn't be shadowing effect anymore, as they become part of the same scope.
Thank you so much for your help and correcting me. So much to learn!