Javascript String tryParseToFixed(decimalPlaces)
String.prototype.tryParseToFixed = function(decimalPlaces) { if(!decimalPlaces) decimalPlaces = 0; if (isNaN(this)) { throw this + ' could not be converted to a Number.'; } return parseFloat(this).toFixed(decimalPlaces); }