+ 1
Define variables all at once or as called?
I am writing a canvas animation and was wondering. can I declare all my variables at the beginning of script or is it better to declare as they are called? pros and cons?
3 odpowiedzi
+ 2
Declare variables where the code will be more readable.
https://github.com/borislavvv00
chech my github acount to see how i do it.
+ 2
Don't declare all your variables at the beginning. This will make them global. Global variables are a no-no. Try to avoid them.