JavaScript Scope
<!DOCTYPE html> <html> <body> <h2>Block Scope</h2> <script> { let message = "inside the block"; console.log(message); // "inside the block" } // console.log(message); // ReferenceError: message is not defined if (true) { const limit = 10; console.log(limit); // 10 } // limit is not accessible here </script> </body> </html>