From 8613348076140c4143bf0e3dc89df92f0bd0099b Mon Sep 17 00:00:00 2001 From: GabrieleC Date: Sat, 23 May 2020 20:37:30 +0200 Subject: [PATCH] Fix typo --- 1-js/04-object-basics/07-optional-chaining/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/04-object-basics/07-optional-chaining/article.md b/1-js/04-object-basics/07-optional-chaining/article.md index f136b957..89363e43 100644 --- a/1-js/04-object-basics/07-optional-chaining/article.md +++ b/1-js/04-object-basics/07-optional-chaining/article.md @@ -124,7 +124,7 @@ user2.admin?.(); 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. -Then `?.()` checks the left part: if the user exists, then it runs (for `user1`). Otherwise (for `user2`) the evaluation stops without errors. +Then `?.()` checks the left part: if the admin function exists, then it runs (for `user1`). Otherwise (for `user2`) the evaluation stops without errors. 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.