Skip to content

predict · control

A `switch` with one missing `break`.

Answer before anything runs. Then the machine runs it, and you can step through what it did.

function describe(level) {
  let out = "";
  switch (level) {
    case 1:
      out += "low";
    case 2:
      out += "medium";
      break;
    default:
      out += "high";
  }
  return out;
}
const one = describe(1);
const three = describe(3);
What does `one` hold when the program has finished?
What does `three` hold when the program has finished?