switch Statement

A statement that selects a code path by matching one value against cases.

What does switch Statement do in JavaScript?

switch Statement — A statement that selects a code path by matching one value against cases.

switch (size) {
    case "M":
        label = "Medium";
        break;
    default:
        label = "Other";
}

Level: Novice · More JavaScript terms at this level

Updated

In other subjects