0 votes
in JavaScript by
What are global variables in Javascript?

1 Answer

0 votes
by

Global variables are those that are available throughout the length of the code without any scope. The var keyword is used to declare a local variable but if you omit it then it will become global variable

msg = "Hello"; // var is missing, it becomes global variable
...