Monday 14 December 2020

Optional chaining is one of the new JavaScript language features that are available as of Node.js 14

 Optional chaining allows you to read the value of a nested property without having to check whether each preceding reference is valid. We can demonstrate this syntax in the REPL. First, we'll define a JSON object that has nested properties. Copy and paste the following into the REPL: