Spot the bug - #108: Traffic Light Cycle

Traffic light cycles forever but skips a color, why

const lights = ['red', 'yellow', 'green'];
let index = 0;

function nextLight() {
  const current = lights[index];
  console.log('Now showing:', current);

  switch (current) {
    case 'red':
      index = 1;
      break;
    case 'yellow':
      index = 2;
    case 'green':
      index = 0;
      break;
  }
}

setInterval(nextLight, 1000);

Reply with what is broken and how you would fix it.

Missing “break” in yellow causes it to jump straight to the green case.

ooh a guess on the table, noted. answer drops later today, gonna leave everyone hanging till then :smiling_face_with_sunglasses: