Nullish Coalescing Operator (??) null and undefined

(??) Is known as the Null coalescing operator in JavaScript

Val1 = null ?? 10  // 10
Val2 = undefined ?? 15 // 15

Instead of 10 and 15 a complex function can be placed here.
For example, if the DB or API response is null / undefined we can safely avoid the null exception with this (??) Operator.

Popular posts from this blog

The third parameter - Event bubbling and Event capturing

Binary Sreach Algorithm : Optimized way to get the index of the mid element

Abstract classes