# 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.

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

Level: Novice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/novice)

Updated: September 27, 2026

## In other subjects

- [switch Statement in Java](https://www.ask-codey.com/glossary/switch-statement)

Source: https://www.ask-codey.com/glossary/switch-statement-javascript
