# switch Statement

*noun*

say it: **“SWICH STAYT-ment”** **/swɪtʃ ˈsteɪtmənt/**

A statement that compares one value against a list of cases and runs the code for the case that matches, with default for no match.

## 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";
}
```

## In a sentence

- “My **switch statement** turns the size "S", "M" or "L" into a price.”

Level: Novice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=1)

Updated: November 9, 2026

## In other subjects

- [switch Statement in C#](https://www.ask-codey.com/glossary/switch-statement-c-sharp)
- [switch Statement in Java](https://www.ask-codey.com/glossary/switch-statement)
- [switch Statement in PowerShell](https://www.ask-codey.com/glossary/switch-statement-powershell)

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