Created
May 18, 2022 11:16
-
-
Save rawnly/ffa7d6b7c4914b481f15d4cab987be27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Numbers { | |
#data: number[]; | |
#max = 0; | |
addNumber(num: number) { | |
this.#max = Math.max(num, this.#max); | |
this.#data.push(num); | |
} | |
getAll(): number[] { | |
return this.#data; | |
} | |
deleteLast() { | |
this.#data = this.#data.slice(0, this.#data.length - 2); | |
} | |
getMax(): number { | |
return this.#max; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Numbers { | |
addNumber(num: number): void; | |
getAll(): number[]; | |
deleteLast(): void; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment