Created
March 24, 2018 21:19
-
-
Save r37r0m0d3l/a961b47f521308667b400b2f57c716b3 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
| const required = () => {throw new Error('Missing parameter')}; | |
| //The below function will trow an error if either "a" or "b" is missing. | |
| const add = (a = required(), b = required()) => a + b; | |
| add(1, 2) //3 | |
| add(1) // Error: Missing parameter. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment