All challenges
Bank Account with Parameter Properties
easyclasses50 XPProblem
Create a BankAccount class whose constructor uses a parameter property to declare and initialize a private balance in one step. Add deposit(amount: number): void, withdraw(amount: number): boolean that returns false (without changing the balance) when funds are insufficient, and getBalance(): number.
Expected output
150
false
true
75Hints
Stuck? Reveal hints one at a time.
Solution
Try solving it yourself first — revealing is always available.
Press Run in the editor — your console output is checked automatically.
No errors
Loading...
Console output appears here. Press Run or just type — the code compiles automatically.