Skip to content

Glossary: JavaScript Basics

throw

Also written: throw new Error

A statement that raises an error, such as `throw new Error("Bad quantity")`. It ends the function and any caller until a `catch` handles it.

Where the book teaches it

Related terms

catchnewException