forked from appacademy/practice-for-week-04-DRY
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpractice.js
37 lines (32 loc) · 863 Bytes
/
practice.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
function multiplyBiggerNumByTwo(num1, num2) {
let bigNum = bigger(num1, num2, true)
return bigNum * 2
}
function divideBiggerNumByThree(num1, num2) {
let bigNum = bigger(num1, num2, true)
return bigNum / 3
}
function eatMostTacos(sum1, sum2) {
let bigNum = bigger(sum1, sum2, true)
return `I ate ${bigNum} tacos.`;
}
function adoptSmallerDog(weight1, weight2) {
let smallNum = bigger(weight1, weight2, false)
return `I adopted a dog that weighs ${smallNum} pounds.`;
}
const bigger = (num1, num2, condition) => {
if(condition){
return num1 > num2 ? num1: num2
}
else{
return num1 < num2 ? num1: num2
}
}
/**************************************************************************/
/* DO NOT CHANGE THE CODE BELOW */
module.exports = {
multiplyBiggerNumByTwo,
divideBiggerNumByThree,
eatMostTacos,
adoptSmallerDog
};