Last active
December 6, 2019 04:32
-
-
Save daubattu/0761ee09bd85c89cae6c57aca1ba8985 to your computer and use it in GitHub Desktop.
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
// Written as of ES2019 | |
if (onError) { // Testing if onError really exists | |
onError(); | |
} | |
// Using optional chaining with function calls | |
onError?.(); // no exception if onError is undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment