0

This is the result am looking for. but it gives me different result.

Gold Medal Silver Medal Bronze Medal 4 5 6 7 8 9 10

for (var i = 1; i <= 10; i++) {
  switch (i) {
    case 1:
      console.log("Gold Medal");

    case 2:
      console.log("Silver Medal");

    case 3:
      console.log("Bronze Medal");

    default:
      console.log(i);
  }
}
Mira
  • 1
  • 1

1 Answers1

0

See the documentation on MDN:

and executes statements after the first case clause with a matching value, until a break statement is encountered

You have no break statements.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335