💾isCurrentlyInGlobalScope()
JS ⟩ concepts ⟩ scope ⟩ global ⟩ isCurrentlyInGlobalScope()
// must use arrow function to get the enclosing context
const isCurrentlyInGlobalScope = () => this === globalThis;
isCurrentlyInGlobalScope() // ✅ true (top-level scope == global scope)
isCurrentlyInGlobalScope() // ❌ false (top-level scope == module scope)❗️