Question: what is difference between local and global scope in javascript?
Answer: The scope of a variable is the region of your program in which it is defined. ... Global Variables − A global variable has a global scope which means it can be defined anywhere in your JavaScript code. Local Variables − A local variable will be visible only within a function where it is defined.