This repository was archived by the owner on Oct 26, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathexercise2.js
More file actions
50 lines (38 loc) · 1.13 KB
/
exercise2.js
File metadata and controls
50 lines (38 loc) · 1.13 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
/*
Logical Operators
---------------------------------
This program calls some functions that are either missing or incomplete.
Update the code so that you get the expected result.
*/
function isNegative(number) {
return number < 0;
}
function isNegative(number) {
return number < 0;
}
function isBetween5and10(number) {
return number >= 5 && number <= 10;
}
function isShortName(name) {
return name.length >= 6 && name.length <= 10;
}
function startsWithD(name) {
return name[0] === "D";
}
/*
DO NOT EDIT BELOW THIS LINE
--------------------------- */
console.log("Is -10 is a negative number?", isNegative(-10));
console.log("Is 5 a negative number?", isNegative(5));
console.log("Is 10 in the range 5-10?", isBetween5and10(10));
console.log("Is Daniel a short name?", isShortName("Daniel"));
console.log("Does Daniel start with 'D'?", startsWithD("Daniel"));
/*
EXPECTED RESULT
---------------
Is -10 is a negative number? true
Is 5 a negative number? false
Is 10 in the range 5-10? true
Is Daniel a short name? true
Does Daniel start with 'D'?
*/