Render Javascript Number As Solidity Erc20 Decimals
When you create an ERC20 cryptocurrency in solidity you initialize it with a number of decimals. If you total supply is 10k and the number of decimals is 4, your token supply will
Solution 1:
I think what you are looking for is Number.prototype.toFixed
var a = 250000, b = 1, c = 25.5console.log(a.toFixed(4), b.toFixed(4), c.toFixed(4))
And if you need the comma seperator, Intl.NumberFormat:
console.log(newIntl.NumberFormat('en-GB', { useGrouping: true, minimumFractionDigits: 4 }).format(250000))
Post a Comment for "Render Javascript Number As Solidity Erc20 Decimals"