Skip to content

Commit 3bd8e29

Browse files
author
Edward King
committed
worked on exercise
1 parent 7d9ce17 commit 3bd8e29

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

exceptions/exercises/divide.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@
55
// However, if the denominator is zero you should throw the error, "Attempted to divide by zero."
66

77
// Code your divide function here:
8+
function divide(numerator, denominator) {
9+
if (denominator === 0) {
10+
throw Error('You cannot divide by zero!');
11+
}
12+
return numerator/denominator;
13+
}

0 commit comments

Comments
 (0)