-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathbooleans.dev.js
More file actions
143 lines (118 loc) · 2.73 KB
/
booleans.dev.js
File metadata and controls
143 lines (118 loc) · 2.73 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
140
141
142
143
"use strict";
/* eslint-disable func-names */
var negate = function negate(a) {
// your code here
return !a;
};
var both = function both(a, b) {
// your code here
return a && b;
};
var either = function either(a, b) {
// your code here
return a || b;
};
var none = function none(a, b) {
// your code here
return !a && !b;
};
var one = function one(a, b) {
// your code here
if (a || b || a) {
return true;
}
return false;
};
var truthiness = function truthiness(a) {
// your code her
if (a) {
return true;
}
return false;
};
var isEqual = function isEqual(a, b) {
// your code here
return a === b;
};
var isGreaterThan = function isGreaterThan(a, b) {
// your code here
return a > b;
};
var isLessThanOrEqualTo = function isLessThanOrEqualTo(a, b) {
// your code here
return a <= b;
};
var isOdd = function isOdd(a) {
// your code here
if (a % 2 !== 0) {
return true;
}
return false;
};
var isEven = function isEven(a) {
// your code here
if (a % 2 == 0) {
return true; // eslint-disable-next-line no-else-return
} else {
return false;
}
};
var isSquare = function isSquare(a) {
// your code here
return Math.sqrt(a) === Math.round(Math.sqrt(a));
};
var startsWith = function startsWith(string, _char) {
// your code here
if (string.startsWith(_char)) {
return true;
}
return false;
};
var containsVowels = function containsVowels(string) {
var vowels = ["a", "e", "i", "o", "u"]; // convert vowels to same casing
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = string.toLowerCase()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var letterInString = _step.value;
if (vowels.includes(letterInString)) {
return true;
}
return false;
} // your code here
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
};
var isLowerCase = function isLowerCase(string) {// your code here
};
module.exports = {
negate: negate,
both: both,
either: either,
none: none,
one: one,
truthiness: truthiness,
isEqual: isEqual,
isGreaterThan: isGreaterThan,
isLessThanOrEqualTo: isLessThanOrEqualTo,
isOdd: isOdd,
isEven: isEven,
isSquare: isSquare,
startsWith: startsWith,
containsVowels: containsVowels,
isLowerCase: isLowerCase
}; // program to count the number of vowels in a string
// defining vowels