We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01c04ce commit 93fe1e4Copy full SHA for 93fe1e4
exceptions/exercises/divide.js
@@ -1,13 +1,13 @@
1
// Write a function called 'divide' that takes two parameters: a numerator and a denominator.
2
-function divide(numerator, denominator) {
3
- if (denominator === 0) {
4
- throw Error('Attempted to divide by zero.');
5
- }
6
- return numerator / denominator;
7
-}
8
9
// Your function should return the result of numerator / denominator.
10
11
// However, if the denominator is zero you should throw the error, "Attempted to divide by zero."
12
13
// Code your divide function here:
+function divide(numerator, denominator) {
+ if (denominator === 0) {
+ throw Error('Attempted to divide by zero.');
+ }
+ return numerator / denominator;
+}
0 commit comments