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
1 Answer
+ 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.