Skip to content

Commit e658f2e

Browse files
committed
fix: lesson_12 extra credit
1 parent 62db949 commit e658f2e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lesson_12/structs_ts/src/stack.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@ export class Stack {
2020
}
2121

2222
peek(): number | null {
23-
if (this.top !== null && this.top !== undefined) {
24-
return this.top.val;
25-
}
26-
return null;
23+
return this.top ? this.top.val : null;
2724
}
2825

2926
isEmpty(): boolean {
30-
return this.top == null;
27+
return this.top === undefined;
3128
}
3229
}

0 commit comments

Comments
 (0)