Skip to content

Glossary: JavaScript Beyond the Basics

Guard clause

Also written: guard clauses

An early check at the top of a function that throws or returns as soon as input is wrong, so the code below can assume good data. It belongs where data enters the program.

Where the book teaches it

Related terms

AggregateError