File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
1-js/04-object-basics/07-optional-chaining Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -74,12 +74,12 @@ That's why the optional chaining `?.` was added to the language. To solve this p
7474
7575## Optional chaining
7676
77- The optional chaining ` ?. ` stops the evaluation if the part before ` ?. ` is ` undefined ` or ` null ` and returns that part .
77+ The optional chaining ` ?. ` stops the evaluation if the value before ` ?. ` is ` undefined ` or ` null ` and returns ` undefined ` .
7878
7979** Further in this article, for brevity, we'll be saying that something "exists" if it's not ` null ` and not ` undefined ` .**
8080
8181In other words, ` value?.prop ` :
82- - is the same as ` value.prop ` if ` value ` exists,
82+ - works as ` value.prop ` , if ` value ` exists,
8383- otherwise (when ` value ` is ` undefined/null ` ) it returns ` undefined ` .
8484
8585Here's the safe way to access ` user.address.street ` using ` ?. ` :
You can’t perform that action at this time.
0 commit comments