Saturday, 10 March 2012

How Round a Number for two Decmal Places in Javascript

   function roundVal(val)
      {
    var dec = 2; // Give Desicmal Places You Want
    var result =  Math.round(val*Math.pow(10,dec))/Math.pow(10,dec);
    return result;
      }

No comments:

Post a Comment