new Error(msg);
};
const Account = (name, accountNubmer, password) => ({
name,
accountNubmer,
balance: 0,
password
});
const deposit = (account, amount, pass) =>
account.password === pass ? { ...account, balance: account.balance + amount } : thr("Wrong password");
const acc = Account("asd", "123-456-789", "passowrd");
console.log(acc)
deposit(acc, 100, "passowrd");
console.log(acc);
Let me check
Log the return value
deposit does not mutate acc, store the return value of deposit() and log it
Обсуждают сегодня