Skip to content

Instantly share code, notes, and snippets.

@br0xen
Created May 25, 2012 14:28
Show Gist options
  • Save br0xen/2788431 to your computer and use it in GitHub Desktop.
Save br0xen/2788431 to your computer and use it in GitHub Desktop.
Percent Formatter for JavaScript Number Prototype
Number.prototype.formatPercent=function(d,sym){var n=this,d=d==undefined?0:d,sym=sym==undefined?"%":sym;return ""+(Math.round(n*(Math.pow(10,d)))/(Math.pow(10,d)))+sym;};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment