Update optional-chaining/article.md

`?.` returns `undefined`
This commit is contained in:
Gleb 2022-03-30 13:51:54 +04:00 committed by GitHub
parent 72e958b9c9
commit de4f81e792
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,7 +103,7 @@ The code is short and clean, there's no duplication at all.
Here's an example with `document.querySelector`:
```js run
let html = document.querySelector('.elem')?.innerHTML; // will be null, if there's no element
let html = document.querySelector('.elem')?.innerHTML; // will be undefined, if there's no element
```
Reading the address with `user?.address` works even if `user` object doesn't exist: