Fix syntax enumeration in 1.4.7
Currently, syntax of the 1 and 3 cases is the same.
This commit is contained in:
parent
6fca8a4b31
commit
4320617f8a
1 changed files with 1 additions and 1 deletions
|
@ -164,7 +164,7 @@ The `?.` syntax has three forms:
|
|||
|
||||
1. `obj?.prop` -- returns `obj.prop` if `obj` exists, otherwise `undefined`.
|
||||
2. `obj?.[prop]` -- returns `obj[prop]` if `obj` exists, otherwise `undefined`.
|
||||
3. `obj?.method()` -- calls `obj.method()` if `obj` exists, otherwise returns `undefined`.
|
||||
3. `obj.method?.()` -- calls `obj.method()` if `obj.method` exists, otherwise returns `undefined`.
|
||||
|
||||
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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue