Skip to content

Glossary: Software Design Patterns in JavaScript

Optional chaining (?.)

Also written: ?.

Calls a method or reads a property only if the value isn't undefined or null, otherwise it does nothing. history.pop()?.undo() safely does nothing when the stack is empty.

Where the book teaches it

Related terms

Nullish coalescing (??)Undo stack