Skip to content

Commit 9141a27

Browse files
authored
Merge pull request #1922 from GabrieleC/master
Fix typo
2 parents 0da5b2b + 8613348 commit 9141a27

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
@@ -124,7 +124,7 @@ user2.admin?.();
124124
125125
Here, in both lines we first use the dot `.` to get `admin` property, because the user object must exist, so it's safe read from it.
126126
127-
Then `?.()` checks the left part: if the user exists, then it runs (for `user1`). Otherwise (for `user2`) the evaluation stops without errors.
127+
Then `?.()` checks the left part: if the admin function exists, then it runs (for `user1`). Otherwise (for `user2`) the evaluation stops without errors.
128128
129129
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.
130130

0 commit comments

Comments
 (0)