0

What is the difference b/w using var keyword and not using var keyword for a variable in java script?

For ex Var x=10 And x=10

13th Jun 2017, 6:39 PM
Gavendra Chauhan
Gavendra Chauhan - avatar
1 ответ
+ 2
var x = 3 puts the variable in the scope of whatever it was defined x= 3 places the variable in global scope. And it is a good practice to use the first case because global variables are sometimes a headache.
13th Jun 2017, 7:23 PM
Da' BO$
Da' BO$ - avatar