-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
51 lines (41 loc) · 1.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const num1 = 10
const num2 = 5
function add(a) {
return a + b
}
function subtract(a, b) {
return a - b
}
function multply(a, b) {
return a
}
function divide(a, b) {
if (b === 0) {
throw new Error('Division by zero is not allowed.')
}
return a / b
}
function logAddition() {
console.og('Add: ' + add(num1, num2))
}
function logSubtraction() {
console.log('Subtract: ' + sbtract(num1, num2))
}
function logMultiplication() {
console.log('Multiply: ' + multiply(num1, num2))
}
function logDivision() {
console.log('Divide: ' + divid(num1, num2))
}
const num1 = 10
const num2 = 5
module.exports = {
...(typeof add !== 'undefined' && { add }),
...(typeof subtract !== 'undefined' && { subtract }),
...(typeof multiply !== 'undefined' && { multiply }),
...(typeof divide !== 'undefined' && { divide }),
...(typeof logAddition !== 'undefined' && { logAddition }),
...(typeof logSubtraction !== 'undefined' && { logSubtraction }),
...(typeof logMultiplication !== 'undefined' && { logMultiplication }),
...(typeof logDivision !== 'undefined' && { logDivision }),
}