File tree Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 1
- HW_VERSION = your homework version here
1
+ HW_VERSION = B
Original file line number Diff line number Diff line change 5
5
* @returns
6
6
*/
7
7
export function isLeapYear ( year : number ) : boolean {
8
+ // To determine a leap year, it has to be divisible by 4.
9
+ if ( year % 4 === 0 ) {
10
+ return true ;
11
+ }
12
+
13
+ if ( year % 100 === 0 ) {
14
+ return false ;
15
+ }
16
+
17
+ if ( year % 400 === 0 ) {
18
+ return true ;
19
+ }
20
+
8
21
return false ;
9
22
}
10
23
@@ -14,8 +27,16 @@ export function isLeapYear(year: number): boolean {
14
27
* @param num
15
28
* @returns
16
29
*/
30
+ // To determine if anumber is even is has to be divisible by 2 with no remainder.
31
+ // To determine if a number is odd, it will not be divisible by 2 evenly.
17
32
export function isEvenOrOdd ( num : number ) : string {
18
33
return "" ;
34
+ if ( num % 2 === 0 ) {
35
+ return "even" ;
36
+ }
37
+ if ( num % 3 === 0 ) {
38
+ return "odd" ;
39
+ }
19
40
}
20
41
21
42
/**
@@ -24,6 +45,26 @@ export function isEvenOrOdd(num: number): string {
24
45
* @param word
25
46
* @returns
26
47
*/
48
+ // If any word contains a vowel, it will render true.
49
+ // If a word does not contain a vowel, it will render false.
50
+
27
51
export function hasVowel ( word : string ) : boolean {
28
- return false ;
52
+ const lowerCaseword = word . toLowerCase ( ) ;
53
+ if ( lowerCaseword . includes ( "a" ) ) {
54
+ return true ;
55
+ }
56
+ if ( lowerCaseword . includes ( "e" ) ) {
57
+ return true ;
58
+ }
59
+ if ( lowerCaseword . includes ( "i" ) ) {
60
+ return true ;
61
+ }
62
+ if ( lowerCaseword . includes ( "o" ) ) {
63
+ return true ;
64
+ }
65
+ if ( lowerCaseword . includes ( "u" ) ) {
66
+ return true ;
67
+ } else {
68
+ return false ;
69
+ }
29
70
}
You can’t perform that action at this time.
0 commit comments