Global Scope
noun
say it: “GLOH-bul skohp” /ˈɡloʊbəl skoʊp/
The outermost level of a script, outside every function and block; a variable made there can be used anywhere in the file.
What is Global Scope in JavaScript?
Global Scope — The outermost scope, whose declarations may be available across a script or module.
const taxRate = 0.08;
function addTax(price) {
const tax = price * taxRate;
return price + tax;
}
In a sentence
- “I declared shopName in the global scope, so every function in the file can read it.”
Level: Apprentice · More JavaScript terms at this level
Updated