Posted By

clapfouine on 03/26/07


javascript float decimal real prototype integer round tofixed

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


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.