Scientific Notation – Quick JS Snippy
Saturday, January 16th, 2010Number.prototype.toScientific = function (x) { var parts = this.toExponential(x).split( /[e]\+?/i ,2); return parts[0] + ((parts[1] != 0 && parts [1] != 1)? " × 10<sup>" + parts[1] + "</sup>": ""); }
