0

do we require to declare that a particular variable is a var? Because, even without declaration the j.s. code runs

10th Mar 2018, 2:56 AM
2+2=4
2+2=4 - avatar
4 Respuestas
+ 4
@2+2=4, Global scope means that you can access the variable anywhere in the program!
10th Mar 2018, 3:05 AM
777
777 - avatar
0
whats that global scope mean?
10th Mar 2018, 3:01 AM
2+2=4
2+2=4 - avatar
0
ty. But I still not getting it. can u explqin it with a simple example, since Iam still a beginner
10th Mar 2018, 3:26 AM
2+2=4
2+2=4 - avatar
0
i understood now, whats globalscope and local scope. thanks a lot. But, even though we write 'var a=something' or 'a=something' . both will be global if we write it above all.Then is there any use of using var. I practised ur code. Ur challenge:when a same var is used for local as well as global scope, for a particular function where the local var is used, local value will work there even though global value is different.
10th Mar 2018, 4:03 AM
2+2=4
2+2=4 - avatar