I want to add 2 values together at the method in the customer class. one of them is a number and the other is an object property stored in a new class, the send method(a-b) works well, but the receive method(a+b) doesn’t work as a number because it’s an object and it is like a string in js, what is the solution?
export class Customer {
constructor(name, password, balance) {
{
this.name = name;
this.password = password;
this.balance = balance;
}
this.send = function (amount) {
return (this.balance -= amount);
};
this.receive = function (amount) {
return (this.balance += amount);
};
}
}
export let student = new Customer("alex", "alex", 200);
export let victim1 = new Customer("tom", "cat", 1000);
export let victim2 = new Customer("jerry", "mous", 500);