Tin mới
JavaScript: Scripting language
Web APIs: Programming interfaces
Structuring content with HTML module
Dynamic scripting with JavaScript module
Variables declared with var or created by function declarations in non-strict mode do not have block scope. Variables introduced within a block are scoped to the containing function or script, and the effects of setting
Block scoping rules with let, const, class, or function declaration in strict mode
By contrast, identifiers declared with let, const, and class do have block scope:
Block scoping rules with let, const, class, or function declaration in strict mode
By contrast, identifiers declared with let, const, and class do have block scope:
Block scoping rules with let, const, class, or function declaration in strict mode
By contrast, identifiers declared with let, const, and class do have block scope:
Block scoping rules with let, const, class, or function declaration in strict mode
By contrast, identifiers declared with let, const, and class do have block scope:
Using a block statement as the body of a for loop
A for loop accepts a single statement as its body.
You can declare variables with using or await using in a block, which causes the object stored in the variable to be disposed when control exits the block. For more information, see resource management.
You can declare variables with using or await using in a block, which causes the object stored in the variable to be disposed when control exits the block. For more information, see resource management.
You can declare variables with using or await using in a block, which causes the object stored in the variable to be disposed when control exits the block. For more information, see resource management.
This page was last modified on Jul 29, 2025 by MDN contributors.