When to Use ‘??’ and ‘||’ in JavaScript and TypeScript

A short guide on when to use ‘??’ and ‘||’ when checking values in JavaScript and TypeScript code

--

Photo by Towfiqu barbhuiya on Unsplash

In this short post, I want to share a simple way to remember when to use ?? and || when checking values in JavaScript and TypeScript code.

When to use ?? when checking a…

--

--