Skip to content

Instantly share code, notes, and snippets.

@MauricioRobayo
Last active August 15, 2022 19:53
Show Gist options
  • Select an option

  • Save MauricioRobayo/4179ee9da44fbe510f7c5df869e0c2b7 to your computer and use it in GitHub Desktop.

Select an option

Save MauricioRobayo/4179ee9da44fbe510f7c5df869e0c2b7 to your computer and use it in GitHub Desktop.
Optional chaining operator
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