I\'m trying to create a javascript function that can take a fraction input string such as \'3/2\' and convert it to decimal—either as a string \'1.5\'
\'3/2\'
\'1.5\'
To convert a fraction to a decimal, just divide the top number by the bottom number. 5 divided by 3 would be 5/3 or 1.67. Much like:
function decimal(top,bottom) { return (top/bottom) }
Hope this helps, haha