Created
June 22, 2017 21:28
-
-
Save fernandocanizo/915a51247fa3aab39f2885282c9fcfa7 to your computer and use it in GitHub Desktop.
Mandatory parameters
This file contains 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 mandatoryParameter = (parameterName) => { | |
throw Error(`Parameter '${parameterName}' is mandatory`); | |
}; | |
const foo = (fluffyDragon = mandatoryParameter('fluffyDragon')) => console.log(fluffyDragon); | |
foo('Spooky'); | |
foo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment