Skip to content

Commit f613e03

Browse files
authored
Maybe it should be marked as code
1 parent 2cca9a9 commit f613e03

File tree

1 file changed

+1
-1
lines changed
  • 1-js/04-object-basics/07-optional-chaining

1 file changed

+1
-1
lines changed

1-js/04-object-basics/07-optional-chaining/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ userGuest.admin?.(); // nothing (no such method)
168168
169169
Here, in both lines we first use the dot (`userAdmin.admin`) to get `admin` property, because we assume that the user object exists, so it's safe read from it.
170170
171-
Then `?.()` checks the left part: if the admin function exists, then it runs (that's so for `userAdmin`). Otherwise (for `userGuest`) the evaluation stops without errors.
171+
Then `?.()` checks the left part: if the `admin` function exists, then it runs (that's so for `userAdmin`). Otherwise (for `userGuest`) the evaluation stops without errors.
172172
173173
The `?.[]` syntax also works, if we'd like to use brackets `[]` to access properties instead of dot `.`. Similar to previous cases, it allows to safely read a property from an object that may not exist.
174174

0 commit comments

Comments
 (0)