var really is for. The purpose for using the
var keyword on a variable is to make it locally scoped. This means that if you use that inside a function, the variable’s scope is gone once the function is finished processing. I never noticed any difference with using a
var or not simply because there never came a point in time that I would be having problems with the values of a variable. Until now. When I had problems with the values on a single variable, I was confused why. I tried to add the
var keyword thinking, who knows right? And it worked! That was the time I decided to look up the purpose of the
var keyword in Google and found the answer.
I laugh at myself why I discovered this until now after so many years. But hey, better late than never right? At least now I know he he he :D.