in JavaScript by
Q:
What are the valid scopes of a variable in JavaScript?

1 Answer

0 votes
by

The scope of a variable is the region of your program in which it is defined. JavaScript variable will have only two scopes.

Global Variables − A global variable has global scope which means it is visible everywhere in your JavaScript code.

Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.

Click here to read more about JavaScript
Click here to read more about Insurance

Related questions

0 votes
asked Oct 19, 2019 in JavaScript by SakshiSharma
0 votes
asked Jul 26, 2020 in Spring by SakshiSharma
0 votes
asked Aug 22, 2019 in Selenium by john ganales
0 votes
asked Dec 11, 2020 in JavaScript by SakshiSharma
0 votes
asked Oct 19, 2019 in JavaScript by SakshiSharma
...