3 ms·
This is really pleasant, when combined with the nullish coalescing operator: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish
by KronisLV 2y ago
This is really pleasant, when combined with the nullish coalescing operator: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
const isStatusValid = myStore.someObject?.isStatusValid ?? false;
(e.g. if some data is not initialized along the way, or you put in some new object which just isn't meant to have that field but some related logic needs to check for it)