×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: petecocoon
Added: Sep 13, 2012 12:07 PM
Views: 1921
  1.         String.prototype.parseFloat = function(decimal){
  2.                 var floatVal = parseFloat(this.replace(',', '.'));
  3.                 if (decimal){
  4.                         return Math.floor((Math.pow(10, decimal) * floatVal)) / Math.pow(10, decimal);         
  5.                 }
  6.                 return floatVal;
  7.         };