Skip to content
20 linesCodeBlameRaw
1// Small helpers for numbers.
2/** Returns the sum of a and b. */
3function add(a, b) {
4 return a + b;
5}
6
7/** Returns the product of a and b. */
8function multiply(a, b) {
9 return a * b;
10}
11
12/** Returns a divided by b; throws a RangeError when b is 0. */
13function divide(a, b) {
14 if (b === 0) {
15 throw new RangeError("Division by zero");
16 }
17 return a / b;
18}
19
20module.exports = { add, multiply, divide };