Nested Blocks

You can introduce nested code blocks, for example, if you want to limit the scope of a variable.

let x = 10;

{   
    let y = 30;
    
    x = y;
}

x == 30;

// The variable `y` is inaccessible here.

In contrast to JavaScript, variables introduced within the nearest local namespace context (e.g., a code block) exist only until the end of that context.