Decimal to Fraction in JavaScript
<p>I wrote this simple script to convert a decimal to a fraction but it is not working. Nothing is outputted.</p>

<pre><code>var decimal = 1.75;
var decimalArray = decimal.split("."); // 1.75
var leftDecimalPart = decimalArray[0]; // 1
var rightDecimalPart = decimalArray[1]; // 75

var numerator = leftDecimalPart + rightDecimalPart; // 175
var denominator = Math.pow(10, rightDecimalPart.length); // 100

document.write(numerator + " / " + denominator);
</code></pre>

<p>JS Bin: <a href="http://jsbin.com/exepir/1/edit" rel="nofollow">http://jsbin.com/exepir/1/edit</a></p>
