Error

noun

say it: “AIR-er” /ˈɛrər/

An object JavaScript makes when something goes wrong, with a name such as TypeError and a message saying what happened.

What is Error in JavaScript?

Error — An object describing a problem that interrupted normal execution.

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

In a sentence

  • “The error said TypeError: Cannot read properties of undefined (reading 'name').”

Level: Journeyman · More JavaScript terms at this level

Updated