Skip to content

CodeDiscovery

Optional Chaining

Optional Chaining (?.) – Question mark and Dot in JavaScript

Optional chaining (?.) in JavaScript is part of the ES2020 release. This operator enables us to safely access nested properties by handling null/undefined references. In simple words, the Optional chaining operator when met with a non-existing property instead of throwing a reference error, it returns undefined. Example How it works?… Read More »Optional Chaining (?.) – Question mark and Dot in JavaScript