JavaScript Local Variables
A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.
Example: Let’s see the simple example of global variable in JavaScript.
Output
After clicking the “summit” button
5
11
18
26
35