It's really recommended to declare var keyword? If I don't, it can affect the readability of the code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

It's really recommended to declare var keyword? If I don't, it can affect the readability of the code?

var javaScript = 10 javaScript = 10

19th Jan 2019, 1:39 AM
Unfair Society
Unfair Society - avatar
2 Answers
+ 2
Always declare with var because without it you effectively declaring a global var (though you have declared it inside a function) and that can have some hard to detect problems
19th Jan 2019, 9:35 AM
KrOW
KrOW - avatar
19th Jan 2019, 2:09 AM
voidneo