# throw

A statement that deliberately raises an exception object.

## What does **throw** do in JavaScript?

**throw** — A statement that deliberately raises an exception object.

```javascript
function reserve(seats) {
    if (seats < 1) {
        throw new Error("Seat count must be positive");
    }
}
```

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

Updated: September 27, 2026

## In other subjects

- [throw in C#](https://www.ask-codey.com/glossary/throw-c-sharp)
- [throw in Java](https://www.ask-codey.com/glossary/throw)

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