JSFiddle - React, Tailwind, and code Playground
JavaScript
var str="250/125";
var patt1=/[0-9]+\//gi;
var oyeah = (str.replace(patt1,'') == 0) ? 0 : eval(str);
document.write( oyeah.toFixed(2) );
var str="250/125";
var patt1=/[0-9]+\//gi;
var oyeah = (str.replace(patt1,'') == 0) ? 0 : eval(str);
document.write( oyeah.toFixed(2) );