Merge pull request #2168 from vsemozhetbyt/patch-3
Fix syntax enumeration in 1.4.7
This commit is contained in:
commit
ae06ca62bb
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`.
|
1. `obj?.prop` -- returns `obj.prop` if `obj` exists, otherwise `undefined`.
|
||||||
2. `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.
|
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