Block in JavaScript A block, or compound statement, in JavaScript is defined by the curly braces {}. It is used to group multiple statements together. For example: { let a = 10; console.log(a); } Why Do We Need to Group Statements? We group ...
Variable shadowing: In JavaScript, variable shadowing occurs when a variable with the same name as a variable in a higher scope is declared in a lower scope, potentially causing confusion; let a = 10; if (true) { let a = 20; console.log(a); } ...