JSitor, now supports
- Optional Chaining - Example - https://jsitor.com/bIhQS-b4Y
- Nullish Coalescing - Example - https://jsitor.com/QIPOSicZu
The optional chaining operator ?. permits reading the value of a property located deep within a chain of connected objects without having to expressly validate that each reference in the chain is valid. The ?. operator functions similarly to the . chaining operator, except that instead of causing an error if a reference is null or undefined, the expression short-circuits with a return value of undefined. When used with function calls, it returns undefined if the given function does not exist.
Try example - https://jsitor.com/bIhQS-b4Y
The nullish coalescing proposal (??) adds a new short-circuiting operator meant to handle default values.
You might already be familiar with the other short-circuiting operators && and ||. Both of these operators handle “truthy” and “falsy” values. Imagine the code sample lhs && rhs. If lhs (read, left-hand side) is falsy, the expression evaluates to lhs. Otherwise, it evaluates to rhs (read, right-hand side). The opposite is true for the code sample lhs || rhs. If lhs is truthy, the expression evaluates to lhs. Otherwise, it evaluates to rhs.
Try example - https://jsitor.com/QIPOSicZu
Give a try and share your feedback. We would love to hear from you guys.
Ashvin Suthar (Creator of JSitor.com)
Follow us on Twitter - https://twitter.com/JSitorEditor