# AbortSignal.timeout()

*noun*

say it: **“uh-BORT SIG-nul TIME-owt”** **/əˈbɔrt ˈsɪɡnəl ˈtaɪmaʊt/**

A JavaScript method that makes a signal which cancels a request, such as a fetch() call, if it hasn't finished within the milliseconds you give it.

## What is **AbortSignal.timeout()** in JavaScript?

**AbortSignal.timeout()** — Makes a signal that gives up after the number of milliseconds you pass. Hand it to `fetch` as `signal`, and a request that takes too long stops with a `TimeoutError` you can catch and explain to the visitor.

```javascript
try {
  const response = await fetch('https://dog.ceo/api/breeds/list/all', {
    signal: AbortSignal.timeout(8000),
  });
  console.log(response.status); // 200
} catch (error) {
  console.log(error.name); // TimeoutError, if it took over 8 seconds
}
```

## In a sentence

- “I passed **AbortSignal.timeout()** with 5000 to fetch, so the dog photo request gives up after five seconds.”
- “When **AbortSignal.timeout()** canceled the request, the page showed "This is taking too long. Try again?"”

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

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/abortsignal-timeout
