Skip to content
⌘K
Explore
Download
Docs
Sign in
Sign up
flagon-io
/
automation-lab
public
Star
0
Overview
Code
Issues
1
Pull requests
Workflows
Deployments
Insights
Files
Commits
Branches
Tags
Releases
Compare
Commit
Add divide to math.js
g1t
bot
and
Claude
agent
committed
6d ago
Parent
0ae9018
Browse files
09400819f669
2
files
+11
−1
0/2 viewed
Files
Collapse all
Unified
Split
math.js
+9
−1
View
Blame
Viewed
9
9
return a * b;
10
10
}
11
11
12
−
module.exports = { add, multiply };
12
+
/** Returns a divided by b; throws a RangeError when b is 0. */
13
+
function divide(a, b) {
14
+
if (b === 0) {
15
+
throw new RangeError("Division by zero");
16
+
}
17
+
return a / b;
18
+
}
19
+
20
+
module.exports = { add, multiply, divide };
test.js
+2
−0
View
Blame
Viewed
3
3
4
4
assert.strictEqual(math.add(2, 3), 5);
5
5
assert.strictEqual(math.multiply(4, 5), 20);
6
+
assert.strictEqual(math.divide(10, 4), 2.5);
7
+
assert.throws(() => math.divide(1, 0), RangeError);
6
8
console.log("all tests passed");