A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-152.js
1switch(1){
2case1:{
3letmsg="one";
4console.log(msg);
5break;
6}
7default:
8console.log("other");
9}
Scope
Answer & explanation
Console output
one
Why
All cases of a switch share a single block scope by default, so a bare let in one case would be visible (and a TDZ hazard) in the others. Wrapping a case body in its own { } braces gives that case a private block scope, letting msg exist only there. This braces-per-case pattern is the standard fix for "let already declared" errors inside switch statements.