I am trying to convert a decimal number into a fractional one. As I already know, there is no direct inbuilt function in JS to do it, so I have come with those steps as a logic:
Step 1 - Find out the number of digits after the decimal point, let's call it Q
Step 2 - Multiply the Numerator and Denominator by 10 with the exponent of Q
Step 3 - Find the greatest common divisor for Numerator and Denominator
Step 4 - Divide the Numerator and Denominator by that greatest common divisor separately
I am now trying to find a way to figure out the number of digits after the decimal point.
I would appreciate your help here if someone can assist to figure this out fully as I am very new to JS and development itself.
Thanks