Skip to content
This repository was archived by the owner on Feb 20, 2019. It is now read-only.

Commit 7dc7680

Browse files
emilkloedenKent C. Dodds
authored andcommitted
feat: Add a 'multiply' function (#63)
Add a function to multiply two numbers: num1 and num2. none
1 parent a4d6a2b commit 7dc7680

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import removeDuplicates from './remove-duplicates'
1616
import add from './add'
1717
import subtract from './subtract'
1818
import divide from './divide'
19+
import multiply from './multiply'
1920

2021
export {
2122
flatten,
@@ -36,4 +37,5 @@ export {
3637
add,
3738
subtract,
3839
divide,
40+
multiply,
3941
}

src/multiply.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default multiply
2+
3+
/**
4+
* This method will perform multiply 2 numbers.
5+
*
6+
* @param {Number} num1 - first number
7+
* @param {Number} num2 - second number
8+
* @return {Number} - Result of multiplying first number by second number
9+
*/
10+
function multiply(num1, num2) {
11+
return num1 * num2
12+
}

test/multiply.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import test from 'ava'
2+
import {multiply} from '../src'
3+
4+
test('Multiplies two integers ', t => {
5+
const number1 = 23
6+
const number2 = 3
7+
const expected = 23 * 3
8+
const actual = multiply(number1, number2)
9+
t.deepEqual(actual, expected)
10+
})

0 commit comments

Comments
 (0)