i am working with crypto currency wallets and every coin have its own decimal values like btc has upto 8 decimal eth has upto 18 decimal
i am facing the issue with decimal fixing
var amount = "0.224424";
var fee = "0.006069";
var t_amount = amount - fee;
t_amount = Number((t_amount).toFixed(18));
and the anwer i am getting in t_amount variable is
0.21835500000000002
but i dont want this value like it has many zeros and at the end a 2
i want this like below
0.21835500000000002 => 0.218355
0.018565000005 => 0.018565
0.0013320001 => 0.001332
anyone have the idea how to fix this issue..?