Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Clean Up Your Null Checks

February 16, 2026

Stop writing deeply nested if statements just to check if a property exists. JavaScript’s optional chaining operator allows you to read the value of a property located deep within a chain of connected objects without having to check each reference. If the reference is nullish, the expression short-circuits and returns undefined instead of throwing a runtime error. It makes your code significantly more concise and less prone to the dreaded cannot read property of undefined crashes.