Global.Number.prototype.toPercent (total, fmt)
return the percentage of a Number according to a given total Number

  • Parameter Int:
    Total
  • Parameter String:
    Format Pattern
  • Returns
    Int Percentage
Sourcecode in /home/hannes/helma/modules/core/Number.js:
56:   Number.prototype.toPercent = function(total, fmt) {
57:       if (!total)
58:           return (0).format(fmt);
59:       var p = this / (total / 100);
60:       return p.format(fmt);
61:   }