0
what is a difference
what is a difference between 1 and 2: 1. function one(){ let ball = 10 } 2.function one(){ ball = 10 } and which situations we can use any of them (if there is a difference)
2 Answers
+ 1
use 1 when you only want to use the variable in the function because it will not work anywhere else but use 2 when reassigning a globally scoped variable one which is not in a function then just gets reassigned in a function this variable is visible everywhere that is why it is called global scoping.
0
Don't use 2 function at all.