scope
๐ง under construction
Last updated
Was this helpful?
๐ง under construction
Last updated
Was this helpful?
โฉ scope
( visibility of variable)
the current context of execution in which values and expressions are "visible" or can be referenced.
concepts about scopes
lexical environment - stores local variables/functions/this.
kindes of scopes
top-level scope - the scope of a JS file.
global scope๏ผ default scope for all code running in script mode.
module scope๏ผ scope for code running in module mode.
function scope๏ผ scope created with a function.
block scope๏ผscope created with a pair of curly braces. (where let / const can belong to)
special scopes
function name scope - where name of function expression lives in.
"for-init" scope - where the for loop initialization variables live in.
but in sloppy mode, you can modify scope (I think the term "scope" is not quite accurate, maybe lexical environment) at runtime. ( ๐ modify current scope at runtimeโ๏ธ)
๐
้่ชชไผผไนๆไธๅๅฅๆช็ "for-init" scope๏ผไฝ่ฃก้ข let ่ฎๆธ็่กจ็พๅ ถๅฏฆๆดๅๆฏ ใ scopes matter with closures โฉ
Kevin Chisholm โฉ
JS.info โฉ
itHome โฉ โฉ