Last active
August 15, 2022 19:53
-
-
Save MauricioRobayo/4179ee9da44fbe510f7c5df869e0c2b7 to your computer and use it in GitHub Desktop.
Optional chaining operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The ?. operator is like the . chaining operator, except that instead of causing an error if a reference is nullish (null or undefined), the expression short-circuits with a return value of undefined. | |
| obj.val?.prop | |
| obj.val?.[expr] | |
| obj.arr?.[index] | |
| obj.func?.(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment