-
-
Save brandonweis/a6022b3afb6b4e655573b2e3193deaa9 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 error_handler = (property) => { | |
| throw new Error(`Error: ${property} is required!`); | |
| } | |
| const monitor_roads = (car=error_handler('Car'), speed=error_handler('Speed')) => { | |
| console.log(`Your ${car} was going at a speed of ${speed}mph.`); | |
| } | |
| monitor_roads('Ferrari', 240); // Your Ferrari was going at a speed of 240mph. | |
| monitor_roads('Ferrari'); // Error: Speed is required! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment