I'm doing an ATM Javascript exercise and it works well, but I thought about improving it by validating the amount of money requested against the amount of money available in the ATM, so I did a "for of" cycle to get the sum available like this:
var caja =
[
new Billete(50, 3),
new Billete(20, 8),
new Billete(10, 6),
new Billete(5, 13),
];
var totalATM;
for( var bill of caja )
{
totalATM += bill.valor * bill.cant;
}
consele(totalATM); //NaN
I do not understand why he does not do the summation and puts it in totalATM. Thanks.