Skip to content

Commit ae06ca6

Browse files
authored
Merge pull request #2168 from vsemozhetbyt/patch-3
Fix syntax enumeration in 1.4.7
2 parents 6fca8a4 + 4320617 commit ae06ca6

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
@@ -164,7 +164,7 @@ The `?.` syntax has three forms:
164164

165165
1. `obj?.prop` -- returns `obj.prop` if `obj` exists, otherwise `undefined`.
166166
2. `obj?.[prop]` -- returns `obj[prop]` if `obj` exists, otherwise `undefined`.
167-
3. `obj?.method()` -- calls `obj.method()` if `obj` exists, otherwise returns `undefined`.
167+
3. `obj.method?.()` -- calls `obj.method()` if `obj.method` exists, otherwise returns `undefined`.
168168

169169
As we can see, all of them are straightforward and simple to use. The `?.` checks the left part for `null/undefined` and allows the evaluation to proceed if it's not so.
170170

0 commit comments

Comments
 (0)