Files
ladybird/Tests/LibJS/Bytecode/input/switch-completion-value.js
Andreas Kling b0b0275e9e LibJS: Add bytecode test for switch statement completion values
The completion value of a switch case is incorrectly reset to undefined
when a statement without a result (like a variable declaration) follows
an expression statement. This will be fixed in the next commit.
2026-02-19 12:02:50 +01:00

4 lines
209 B
JavaScript

console.log(eval("switch(1) { case 1: 'hello'; let x = 1; }"));
console.log(eval("switch(1) { case 1: 'first'; 'second'; }"));
console.log(eval("switch(1) { case 1: 'matched'; break; default: 'default'; }"));