About Lesson
In JavaScript, there are two types of variable and also it tells you where in your program you are allowed to use the variables and functions that you’ve defined.
Local Variable:
üWhen you use JavaScript, local variables are variables that are defined within functions. They have local scope, which means that they can only be used within the functions that define them.
Global Variable:
In contrast, global variables are variables that are defined outside of functions. These variables have global scope, so they can be used by any function without passing them to the function as parameters.
Example:
var a = 10;
function functionName(){
var b = 25;
}
Exercise Files
No Attachment Found
Join the conversation