What is block scope?
Variables declared with let or const inside curly braces {} are accessible only within
that block.
Example:
if (true) {
let y = 20;
const z = 30;
// console.log(y, z); // ReferenceError
Variables declared with let or const inside curly braces {} are accessible only within
that block.
Example:
if (true) {
let y = 20;
const z = 30;
// console.log(y, z); // ReferenceError