forked from bloominstituteoftechnology/Basic-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject-1.js
More file actions
139 lines (114 loc) · 2.05 KB
/
project-1.js
File metadata and controls
139 lines (114 loc) · 2.05 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
const multiplyByTen = (num) => {
return num * 10;
};
const subtractFive = (num) => {
return num - 5;
};
const areSameLength = (str1, str2) => {
return str1.length === str2.length;
};
const areEqual = (x, y) => {
return x === y;
};
const lessThanNinety = (num) => {
if (num < 90) {
return true;
}
return false;
};
const greaterThanFifty = (num) => {
if (num > 50) {
return true;
}
return false;
};
const add = (x, y) => {
return x + y;
};
const subtract = (x, y) => {
return x - y;
};
const divide = (x, y) => {
return x / y;
};
const multiply = (x, y) => {
return x * y;
};
const getRemainder = (x, y) => {
return x % y;
};
const isEven = (num) => {
if (num % 2 === 0) {
return true;
}
return false;
};
const isOdd = (num) => {
if (num % 2 === 0) {
return false;
}
return true;
};
const square = (num) => {
return num * num;
};
const cube = (num) => {
return num * num * num;
};
const raiseToPower = (num, exponent) => {
return num ** exponent;
};
const roundNumber = (num) => {
return Math.round(num);
};
const roundUp = (num) => {
return Math.ceil(num);
};
const addExclamationPoint = (str) => {
return (str += '!');
};
const combineNames = (firstName, lastName) => {
return `${firstName} ${lastName}`;
};
const getGreeting = (name) => {
return `Hello ${name}!`;
};
const getRectangleArea = (length, width) => {
return length * width;
};
const getTriangleArea = (base, height) => {
return 0.5 * base * height;
};
const getCircleArea = (radius) => {
return Math.round(radius * radius * Math.PI);
};
const getRectangularPrismVolume = (length, width, height) => {
return width * height * length;
};
module.exports = {
multiplyByTen,
subtractFive,
areSameLength,
areEqual,
lessThanNinety,
greaterThanFifty,
add,
subtract,
divide,
multiply,
getRemainder,
isEven,
isOdd,
square,
cube,
raiseToPower,
roundNumber,
roundUp,
addExclamationPoint,
combineNames,
getGreeting,
getRectangleArea,
getTriangleArea,
getCircleArea,
getRectangularPrismVolume
};