Is there a way to prepend leading zeros and a dot to numbers so that it results in a string of fixed length? For example: 1 becomes “0.00000001 BTC”. 498 becomes “0.00000498 BTC”. Answer use / to divide, then toFixed(). For example: You can put it in a function: And use it with your examples: