Skip to content

Instantly share code, notes, and snippets.

@ydnax
Created July 17, 2011 21:26
Show Gist options
  • Save ydnax/1088080 to your computer and use it in GitHub Desktop.
Save ydnax/1088080 to your computer and use it in GitHub Desktop.
very ugly and not 100% working fuction to print numbers with a fixed length. don't use this!
Number.prototype.fixedString=function(l){
var s=new String(this.toPrecision(l));
return s.substring(0, l);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment