Javascript Number toMaxFiexed(digits)
Number.prototype.toMaxFiexed = function (digits) { var ret = this.toFixed(digits); ret = ret.replace(/0+$/, '').replace(/\.$/, ''); return ret;/*from ww w .java 2s . co m*/ }