Optional chaining is currently not supported in Node.js version 13 and below. It will be supported from Node.js version 14 and most of the browsers as it is moved to Stage 4. Currently, few platforms are supporting it. You can find the list of platforms supporting optional chaining in the given link. You can enable optional using --harmony flag.

Answer from Balaj Khan on Stack Overflow
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › objects: the basics
Optional chaining '?.'
was added to the language. To solve this problem once and for all! The optional chaining ?. stops the evaluation if the value before ?.
🌐
DEV Community
dev.to › laurieontech › optional-chaining-has-arrived-111l
Optional Chaining Has Arrived! - DEV Community
December 20, 2019 - IMHO the JavaScript standards body is way to conservative in the way they modify and extend the standard... ... Great article! Coming from a Rails background, I've been really missing the .try method in JS. Happy to see it's finally landed. That said, it's difficult to discuss optional chaining without talking about the law of demeter, and exactly how much chaining is the right amount.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Optional_chaining
Optional chaining (?.) - JavaScript | MDN
The optional chaining (?.) operator accesses an object's property or calls a function. If the object accessed or function called using this operator is undefined or null, the expression short circuits and evaluates to undefined instead of throwing an error. const adventurer = { name: "Alice", cat: { name: "Dinah", }, }; const dogName = adventurer.dog?.name; console.log(dogName); // Expected output: undefined console.log(adventurer.someNonExistentMethod?.()); // Expected output: undefined
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-optional-chaining
JavaScript Optional Chaining | GeeksforGeeks
May 17, 2025 - JavaScript Optional chaining is a new feature introduced in ES2020 that simplifies the process of accessing properties nested within objects, especially when dealing with potentially null or undefined values.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-optional-chaining-explained
JavaScript Optional Chaining `?.` Explained - How it Works and When to Use it
August 25, 2020 - Optional chaining, represented by ?. in JavaScript, is a new feature introduced in ES2020. Optional chaining changes the way properties are accessed from deeply nested objects. It fixes the problem of having to do multiple null checks when accessing ...
🌐
Medium
medium.com › @mfarazali › optional-chaining-operator-in-javascript-5866c8cecc68
Optional Chaining Operator (?.) in Javascript | by Muhammad Faraz Ali | Medium
March 14, 2024 - Optional chaining is a powerful feature introduced in ECMAScript 2020 (ES11) that simplifies working with nested object properties and method calls. This operator brings a more concise and safer way to handle optional properties, instead of ...
🌐
Reddit
reddit.com › r/javascript › [askjs] over-using optional chaining. is this pattern common?
r/javascript on Reddit: [AskJS] Over-using optional chaining. Is this pattern common?
January 18, 2021 -

Hi everyone!

I love optional chaining, i really do, but there are some cases where using this syntax damages the readability of the code. One of those cases is the following

function optionalFunction(){     
    console.log("works"); 
}  
// optionalFunction = undefined;  

optionalFunction?.(); 

While i understand this approach, i find it optionalFunction?.() harder to read as opposed to this

function optionalFunction(){     
    console.log("works"); 
}  
// optionalFunction = undefined;  

if(optionalFunction != undefined){     
    optionalFunction(); 
} 

I think i'd rather have a more readable and stronger check than ES6 magic when checking if an optional function is defined.

I believe that optional chaining fixes the problem of checking if a property of an object exists, and if exists, then get the value or keep going deeper in the object structure. But this syntax just looks weird for calling functions, it looks a lot like those "one line cleverness" code that sometimes people encounter.

What are your thoughts about this?

Find elsewhere
🌐
2ality
2ality.com › 2019 › 07 › optional-chaining.html
ES2020: optional chaining
Until now, the following alternatives to optional chaining were used in JavaScript. The following two expressions are roughly equivalent: p.address?.street?.name p.address && p.address.street && p.address.street.name · For each a && b, b is only evaluated (and returned) if a is truthy.
🌐
DEV Community
dev.to › hassanzohdy › 13-es6-optional-chaining-in-javascript-2jd0
13-ES6++: Optional Chaining in Javascript - DEV Community
November 26, 2022 - Optional Chaining Optional chaining is a new feature that was released in ES2020 (ES11).... Tagged with javascript, es6, esnext.
🌐
DEV Community
dev.to › arsalanmeee › optional-chaining-in-javascript-34kj
Optional Chaining in JavaScript - DEV Community
March 2, 2025 - Optional chaining (?.), introduced in ECMAScript 2020, revolutionizes how developers safely access nested properties in JavaScript.
🌐
Byby
byby.dev › js-optional-chaining
JavaScript Optional Chaining
Optional chaining is a new feature in JavaScript, introduced in ES2020, that allows you to safely access nested properties or methods without having to manually check if each property exists.
🌐
Dmitri Pavlutin
dmitripavlutin.com › javascript-optional-chaining
How to Use JavaScript Optional Chaining
Starting from ES2015 and beyond, the features that influenced the most my code are destructuring, arrow functions, classes, and modules system. Optional chaining, as a part of ES2020, changes the way properties are accessed from deep objects ...
🌐
Medium
medium.com › nerd-for-tech › using-the-optional-chaining-operator-in-javascript-aa56d19acef7
Using the optional chaining operator in JavaScript | by saransh kataria | Nerd For Tech | Medium
March 23, 2021 - Destructuring, arrow functions, modules have been some of those features for me. Optional chaining is going to be the next one on that list for me. Optional Chaining is in stage 4 of the ES2020 proposal, therefore should be added to the ...
🌐
TutorialsPoint
tutorialspoint.com › javascript › javascript_optional_chaining.htm
JavaScript - Optional Chaining
Here, the optional chaining operator (?.) comes into the picture to solve the non-existing property problem easily. In JavaScript, optional chining operator (?.) is introduced in ECMAScript 2020 (ES2020).
🌐
V8
v8.dev › features › optional-chaining
Optional chaining · V8
Some other languages offer an elegant solution to this problem with using a feature called “optional chaining”. According to a recent spec proposal, “an optional chain is a chain of one or more property accesses and function calls, the first of which begins with the token ?.”. Using the new optional chaining operator, we can rewrite the above example as follows: // Still checks for errors and is much more readable. const nameLength = db?.user?.name?.length; What happens when db, user, or name is undefined or null? With the optional chaining operator, JavaScript initializes nameLength to undefined instead of throwing an error.
🌐
DEV Community
dev.to › ahmetkapusuz › what-is-optional-chaining-in-javascript-52ik
What is Optional Chaining in JavaScript? - DEV Community
December 13, 2019 - At the time of writing this blog post, optional chaining is reached stage4 in TC39 proposals and prob... Tagged with javascript, es2020, esnext.
🌐
Medium
medium.com › @guigaoliveira_ › entendendo-o-optional-chaining-no-javascript-964ca6928598
Entendendo o Optional Chaining no JavaScript | by Guilherme Oliveira | Medium
December 24, 2019 - Então, são muitas possibilidades para o .?, não é? Recentemente, a proposta Optional Chaining for JavaScript foi para Stage 4 no processo do TC39 e vai fazer parte do ES2020!!! 🤩 Todos os detalhes da proposta se encontram aqui.
🌐
DEV Community
dev.to › codeofrelevancy › javascripts-optional-chaining-operator-3pfn
JavaScript's Optional Chaining (?.) Operator - DEV Community
March 28, 2023 - In this article, we'll be exploring an exciting feature in JavaScript known as the Optional Chaining Operator (?.). This operator has been introduced in ECMAScript 2020 and has since become a staple in modern JavaScript development.