Skip to content

Commit

Permalink
fix: lesson_12 extra credit
Browse files Browse the repository at this point in the history
  • Loading branch information
txtran224 committed Oct 23, 2024
1 parent 62db949 commit e658f2e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lesson_12/structs_ts/src/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ export class Stack {
}

peek(): number | null {
if (this.top !== null && this.top !== undefined) {
return this.top.val;
}
return null;
return this.top ? this.top.val : null;
}

isEmpty(): boolean {
return this.top == null;
return this.top === undefined;
}
}

0 comments on commit e658f2e

Please sign in to comment.