JavaScript Var
JavaScript var
The scope of a variable defined with the keyword “var” is limited to the “function” within which it is defined. If it is defined outside any function, the scope of the variable is global.
var is “function scoped”.
Example
Output
After clicking the “summit” button
5
11
18
26
35