Update article.md
This commit is contained in:
parent
7a67741a9b
commit
75e10e203e
1 changed files with 1 additions and 1 deletions
|
@ -21,7 +21,7 @@ let user = {}; // a user without "address" property
|
|||
alert(user.address.street); // Error!
|
||||
```
|
||||
|
||||
That's the expected result. JavaScript works like this. As `user.address` is `undefined`, an attempt to get `user.address.street` fails with an error.
|
||||
That's the expected result. JavaScript works like this. As `user.address` is `undefined`, an attempt to get `user.address.street` fails with an error.
|
||||
|
||||
In many practical cases we'd prefer to get `undefined` instead of an error here (meaning "no street").
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue