# try Block

*noun*

say it: **“TRY blok”** **/traɪ blɑk/**

The part of a try statement, written try { }, that holds code which might fail, so a failure goes to the catch block instead of stopping the program.

## What is **try Block** in JavaScript?

**try Block** — A block containing code that may throw an exception.

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

## In a sentence

- “I put JSON.parse inside a **try block** because the saved text might be broken.”
- “I put the await fetch line inside a **try block** so a lost connection wouldn't crash the page.”
- “Everything in the **try block** after the failing line was skipped.”

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

Updated: November 9, 2026

## In other subjects

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

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