js convert to fraction
>>> npm install fractional import * from './fraction.js' var frac = new Fraction(0.3435); console.log(frac.toString()); // returns "34/35"
Here is what the above code is Doing:
1. We’re importing the Fraction class from the fractional module.
2. We’re creating a new Fraction object with the value 0.3435.
3. We’re printing the fraction to the console.
The output of the above code is:
34/35