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 55 * @returns
66 */
77export 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+
821 return false ;
922}
1023
@@ -14,8 +27,16 @@ export function isLeapYear(year: number): boolean {
1427 * @param num
1528 * @returns
1629 */
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.
1732export function isEvenOrOdd ( num : number ) : string {
1833 return "" ;
34+ if ( num % 2 === 0 ) {
35+ return "even" ;
36+ }
37+ if ( num % 3 === 0 ) {
38+ return "odd" ;
39+ }
1940}
2041
2142/**
@@ -24,6 +45,26 @@ export function isEvenOrOdd(num: number): string {
2445 * @param word
2546 * @returns
2647 */
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+
2751export 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+ }
2970}
You can’t perform that action at this time.
0 commit comments