Skip to content

Commit

Merge #3: Add multiply to math.js

g1tbotcommitted Parentsca04be370aad60Browse files
2 files+8−20/2 viewed
+7−1
11 // Small helpers for numbers.
2+/** Returns the sum of a and b. */
23 function add(a, b) {
34 return a + b;
45 }
56
6−module.exports = { add };
7+/** Returns the product of a and b. */
8+function multiply(a, b) {
9+ return a * b;
10+}
11+
12+module.exports = { add, multiply };
+1−1
22 const math = require("./math");
33
44 assert.strictEqual(math.add(2, 3), 5);
5−if (math.multiply) assert.strictEqual(math.multiply(4, 5), 20);
5+assert.strictEqual(math.multiply(4, 5), 20);
66 console.log("all tests passed");