In ECMAScript® 2022 Language Specification
It writes:
4. For each CaseClause C of A, do
a. If found is false, then
i. Set found to ? CaseClauseIsSelected(C, input).
b. If found is true, then
i. Let R be the result of evaluating C.
ii. If R.[[Value]] is not empty, set V to R.[[Value]].
iii. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
5. Return NormalCompletion(V).
It seems like the break target, continue target and return completion will be ignored.
a: {
switch (1) {
case 1:
break a;
}
console.log('This should be logged cause break target is ignored')
}
function a() {
switch (1) {
case 1:
return 2
}
console.log("Should log too")
}
a()
// should be 1, 2, 3
for (const i of [1, 2, 3]) {
switch (i) {
case 1:
continue;
}
console.log(i)
}