use /
to divide, then toFixed()
.
For example:
const number = 10;
console.log((number / 100000000).toFixed(8));
You can put it in a function:
const toZerosNumber = number => (number / 100000000).toFixed(8);
And use it with your examples:
toZerosNumber(498); // Output: "0.00000498"
toZerosNumber(1); // Output: "0.00000001"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…