Hello guys,
I’m using the code below to find out currency needed. This is how much do I need from a particular currency compartment of the cid. For instance, currency unit amount is ‘PENNY’ is $0.01 and current compartment in the cid is [‘PENNY’, 1.01]. It works well using the expression below.
let currencyNeeded = Math.floor(change/currencyUnitAmount);
However, Math.floor(0.039999/0.01) is returning 3 instead 4. So deducting 0.03 from the PENNY compartment instead of 0.04. This my challenge.
I’ve gone to the MDN JavaScript documentation and other document. I haven’t any way around it so far. Please, assist me.