Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

switch

Description

The switch of Statements for JS executes code when a condition matches a case.

break ends the switch.

default executes when no case is a match.

Syntax

switch(condition)
{
    case 1:
        code
        break;
    case 2:
        code
        break;
    ...
    default:
        code
}

Examples

if

try

European Computer Manufacturers Association (ECMA)

HomeMenu