DEV Community

Discussion on: How to Check For Undefined in JavaScript / TypeScript

Collapse
 
kais_blog profile image
Kai • Edited

Thanks for this addition. Nullish coalescing operator (??) and optional chaining (?.) are indeed very useful. Nevertheless, the real check for undefined is the one I've described. If you want to check if the property is undefined like in my example - a simple if-statement with typeof is the way to go.