# else Statement

*noun*

say it: **“ELSS STAYT-ment”** **/ɛls ˈsteɪtmənt/**

The part after an if that runs when the if's condition is false: the "otherwise" path.

## What does **else Statement** do in JavaScript?

**else Statement** — A branch that runs when its matching if condition is falsy.

```javascript
if (stock > 0) {
    status = "Available";
} else {
    status = "Sold out";
}
```

## In a sentence

- “I added an **else statement** so the page says "Sorry, we're closed" whenever isOpen is false.”

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

Updated: November 9, 2026

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