🌐
W3Schools
w3schools.com › js › js_2020.asp
W3Schools.com
Optional chaining not only works on object properties, but also on function calls and arrays.
🌐
W3Schools
w3schools.io › javascript › es11-optional-chaining
ES2020(ES11) - Javascript Optional Chaining Operator - w3schools
This tutorial covers the latest javascript features, Optional Chaining Operator released in 2020. ES11 or ES2020 or EcmaScript2020 .
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Optional_chaining
Optional chaining (?.) - JavaScript | MDN
This is an idiomatic pattern in JavaScript, but it gets verbose when the chain is long, and it's not safe. For example, if obj.first is a Falsy value that's not null or undefined, such as 0, it would still short-circuit and make nestedProp become 0, which may not be desirable. With the optional chaining operator (?.), however, you don't have to explicitly test and short-circuit based on the state of obj.first before trying to access obj.first.second:
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › objects: the basics
Optional chaining '?.'
E.g. in user?.address.street.name the ?. allows user to safely be null/undefined (and returns undefined in that case), but that’s only for user. Further properties are accessed in a regular way. If we want some of them to be optional, then we’ll need to replace more .
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
What Is the Optional Chaining Operator, and How Does It Work?
April 8, 2025 - TLDR: Optional Chaining Operator is for objects, not properties? https://www.w3schools.com/jS/js_2020.asp " The Optional Chaining Operator returns undefined if an object is undefined or null (instead of throwing an er…
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-optional-chaining
JavaScript Optional Chaining - GeeksforGeeks
JavaScript Optional Chaining (ES2020) simplifies safe access to deeply nested object properties by preventing errors when values are null or undefined.
Published   June 22, 2020
🌐
W3Schools
w3schools.com › typescript › typescript_special_types.php
TypeScript Special Types
'default'; // Optional chaining (?.) - safely access nested properties const street = user?.address?.street; Important: These types are most useful when strictNullChecks is enabled in your tsconfig.json file. This ensures that null and undefined are only assignable to themselves and any. To enable strict null checks, add this to your tsconfig.json: { "compilerOptions": { "strictNullChecks": true } } ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com
🌐
W3Schools
w3schools.com › nodejs › nodejs_es6.asp
Node.js ES6+ Features
Optional chaining lets you access deeply nested object properties without worrying about null or undefined values in the chain.
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript tutorial › javascript optional chaining operator
JavaScript Optional Chaining Operator (?.)
December 17, 2023 - The optional chaining operator (?.) is like a shortcut for accessing nested properties in a series of objects. Instead of having to check if each step in the chain is empty (null or undefined), you can use the operator ?.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 75322578 › how-do-you-get-data-showing-with-typescript-optional-chaining
How do you get data showing with TypeScript Optional Chaining - Stack Overflow
"If someone can give me a good understanding on how it works both ways" — This is just a combination of some super-basic bits of JS (if, object properties, function calls, and variables) and the optional chaining operator which is what the tutorial you are reading is trying to teach you.
🌐
W3Schools
w3schools.com › typescript › typescript_null.php
TypeScript Null & Undefined
Optional chaining is a JavaScript feature that works well with TypeScript's null handling.
🌐
freeCodeCamp
freecodecamp.org › news › optional-chaining-javascript
Optional Chaining in JavaScript – Explained with Examples
February 13, 2024 - JavaScript development often involves navigating through nested objects, which can be cumbersome and error-prone, especially when dealing with null or undefined values. Enter optional chaining—a game-changer in modern JavaScript syntax. In this artic...
🌐
TypeScript
typescriptlang.org › play › 3-7 › syntax-and-messaging › optional-chaining.ts
TypeScript: Playground Example - Optional Chaining
const artistBio = album?.artist?.bio; ... values (e.g. an empty string, 0, NaN, and, well, false). Optional chaining will only take null or undefined as a signal to stop and return an undefined....
🌐
TypeScript
typescriptlang.org › docs › handbook › release-notes › typescript-3-7.html
TypeScript: Documentation - TypeScript 3.7
At its core, optional chaining lets us write code where TypeScript can immediately stop running some expressions if we run into a null or undefined. The star of the show in optional chaining is the new ?. operator for optional property accesses.
🌐
Swift.org
docs.swift.org › swift-book › LanguageGuide › OptionalChaining.html
Optional Chaining - Documentation | Swift.org
This content has moved; redirecting to the new location · This page requires JavaScript. Please turn on JavaScript and refresh the page
🌐
Codecademy
codecademy.com › docs › javascript › optional chaining
JavaScript | Optional Chaining | Codecademy
August 7, 2025 - The optional chaining operator allows safe access to nested object properties or methods without having to explicitly check if intermediate properties exist.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-optional-chaining
How to Use Optional Chaining in JavaScript
February 7, 2022 - So we can use our nullish coalescing ... chaining is a handy recent feature of JavaScript that lets you check for nullish values while accessing property values....
🌐
TC39
tc39.es › proposal-optional-chaining
Optional Chaining
OptionalChain. Let newReference be ? ChainEvaluation of optionalChain with arguments baseValue and baseReference.
🌐
Dmitri Pavlutin
dmitripavlutin.com › javascript-optional-chaining
How to Use JavaScript Optional Chaining
Optional chaining accesses properties from deep of nested objects without prop existence verification and intermediate variables boilerplates.
🌐
GitHub
github.com › tc39 › proposal-optional-chaining
GitHub - tc39/proposal-optional-chaining
Let’s call Optional Chain an Optional Chaining operator followed by a chain of property accesses, method or function calls.
Starred by 4.9K users
Forked by 72 users
Languages   HTML 97.2% | Shell 2.8%