From c7d30726a221657f4f5eed1eab53ab69c6779f13 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Wed, 13 Jan 2021 19:53:38 +0300 Subject: [PATCH] closes #2433 --- 1-js/04-object-basics/07-optional-chaining/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/04-object-basics/07-optional-chaining/article.md b/1-js/04-object-basics/07-optional-chaining/article.md index 40b74ebe..10480c19 100644 --- a/1-js/04-object-basics/07-optional-chaining/article.md +++ b/1-js/04-object-basics/07-optional-chaining/article.md @@ -74,12 +74,12 @@ That's why the optional chaining `?.` was added to the language. To solve this p ## Optional chaining -The optional chaining `?.` stops the evaluation if the part before `?.` is `undefined` or `null` and returns that part. +The optional chaining `?.` stops the evaluation if the value before `?.` is `undefined` or `null` and returns `undefined`. **Further in this article, for brevity, we'll be saying that something "exists" if it's not `null` and not `undefined`.** In other words, `value?.prop`: -- is the same as `value.prop` if `value` exists, +- works as `value.prop`, if `value` exists, - otherwise (when `value` is `undefined/null`) it returns `undefined`. Here's the safe way to access `user.address.street` using `?.`: