In JavaScript, is there any way to convert a decimal number (such as 0.0002
) to a fraction represented as a string (such as "2/10000"
)?
If a function called decimalToFraction
had been written for this purpose, then decimalToFraction(0.0002)
would return the string "2/10000"
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…