Utilizor
Contact Us

Case & Break

Controlling switch flow.

Case & Break

The value of the expression is compared with the values of each case.

If there is a match, the associated block of code is executed.

The break Keyword

When JavaScript reaches a break keyword, it breaks out of the switch block.

This will stop the execution of more code and case testing inside the block.

Example

case 0:
  day = "Sunday";
  break;