function-scoped variable
nounUK /ˈfʌŋk.ʃən skəʊpt ˈveə.ri.ə.bəl/
US /ˈfʌŋk.ʃən skoʊpt ˈver.i.ə.bəl/
A variable that only works inside the function where it was made.
The counter is a function-scoped variable, so it disappears when the function finishes.
RELATED WORDS
OTHER MEANINGS
2. A variable declared with var inside a function, visible throughout that function.
Because it was declared with var, the loop index is a function-scoped variable.
3. A name that cannot be seen or changed by code outside its function.
Keeping the token as a function-scoped variable stops other code from reading it.
4. A binding created fresh each time the function runs.
Each call makes a new function-scoped variable, so old values do not leak between calls.