Tell us what’s happening:
please help me to pass this when I have my code in the console part I see that
SyntaxError: unknown: Unexpected token (50:0)
and my code
class BankAccount {
constructor() {
this.balance = 0;
this.transactions = \[\];
}
deposit(amount) {
if (amount <= 0) {
return "Deposit amount must be greater than zero.";
}
this.transactions.push({ type: "deposit", amount: amount });
this.balance += amount;
return \`Successfully deposited $${amount}. New balance: $${this.balance}\`;
}
withdraw(amount) {
if (amount <= 0 || amount > this.balance) {
return "Insufficient balance or invalid amount.";
}
this.transactions.push({ type: "withdraw", amount: amount });
this.balance -= amount;
return \`Successfully withdrew $${amount}. New balance: $${this.balance}\`;
}
checkBalance() {
return \`Current balance: $${this.balance}\`;
}
listAllDeposits() {
const deposits = this.transactions
.filter(tx => tx.type === "deposit")
.map(tx => tx.amount);
return \`Deposits: ${deposits.join(",")}\`;
}
listAllWithdrawals() {
const withdrawals = this.transactions
.filter(tx => tx.type === "withdraw")
.map(tx => tx.amount);
return \`Withdrawals: ${withdrawals.join(",")}\`;
}
}
const myAccount = new BankAccount();
myAccount.deposit(200);
myAccount.deposit(150);
myAccount.withdraw(50);
myAccount.withdraw(30);
myAccount.deposit(100);
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Mobile Safari/537.36
Challenge Information:
Build a Bank Account Management Program - Build a Bank Account Management Program

