Posted By

clapfouine on 03/26/07


Tagged

javascript float decimal real prototype integer round tofixed


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


Round floats


 / Published in: JavaScript
 

  1. Number.prototype.toFixed=function(x) {
  2. var temp=this;
  3. temp=Math.round(temp*Math.pow(10,x))/Math.pow(10,x);
  4. return temp;
  5. }

Report this snippet  

You need to login to post a comment.