File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
lesson_07/conditionals/src Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ import { computeLexicographicDistance } from "./util.js";
7
7
* @return True if the age corresponds to a voting age and false otherwise.
8
8
*/
9
9
export function canVote ( age : number ) : boolean {
10
+ if ( age >= 18 ) {
11
+ return true ;
12
+ }
10
13
return false ;
11
14
}
12
15
@@ -18,10 +21,19 @@ export function canVote(age: number): boolean {
18
21
* @return -1 if a is less than b, 1 if a is greater than b, and 0 otherwise.
19
22
*/
20
23
export function compareStrings ( a : string , b : string ) : number {
24
+ if ( a > b ) {
25
+ return 1 ;
26
+ }
27
+ if ( a < b ) {
28
+ return - 1 ;
29
+ }
30
+ if ( a = b ) {
31
+ return 0 ;
32
+ }
21
33
// The distance will be a number less than 0 if string `a` is lexicographically less than `b`, 1
22
34
// if it is greater, and 0 if the strings are equal.
23
35
const distance = computeLexicographicDistance ( a , b ) ;
24
-
36
+
25
37
// TODO(you): Finish this method.
26
38
27
39
return 0 ;
@@ -47,6 +59,8 @@ export function convertGpaToLetterGrade(gpa: number): string {
47
59
* @return The factorial of n.
48
60
*/
49
61
export function computeFactorial ( n : number ) : number {
62
+ let product = 1
63
+ for ( )
50
64
return 0 ;
51
65
}
52
66
You can’t perform that action at this time.
0 commit comments