Those variables that can be accessed from any location in the script are called global variables.
Those variables that can't be accessed from any location and can be accessed within the function are called local variables.
var variable_name;
E.g var a;
<html>
<head>
<title>JavaScript Variable </title>
</head>
<body>
<script type="text/javascript">
function addition(a, b)
{
var c; //Local variable
c = a+b;
return c;
}
var z = addition(11, 5); //Global variable
document.write("Sum of Two number is: " + z);
</script>
</body>
</html>
Output: Sum of Two number is: 16