Nodejs Number to Base Convert toBijectiveBase26( ()

Here you can find the source of toBijectiveBase26( ()

Method Source Code

Number.prototype.toBijectiveBase26 = (function () {
  return function toBijectiveBase26() {
    n = this//from   w w  w .  j a  v a 2 s.c  om
    ret = "";
    while(parseInt(n)>0){
      --n;
      ret += String.fromCharCode("A".charCodeAt(0)+(n%26));
      n/=26;
    }
    return ret.split("").reverse().join("");
  };
}());

Related

  1. toBase(base)
    "use strict";
    Number.prototype.toBase = function (base) {
        var symbols = 
        "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
        var decimal = this;
        var conversion = "";
        if (base > symbols.length || base <= 1) {
            return false;
        while (decimal >= 1) {
            conversion = symbols[(decimal - (base * Math.floor(decimal / base)))] + 
                         conversion;
            decimal = Math.floor(decimal / base);
        return (base < 11) ? parseInt(conversion) : conversion;
    
  2. base(b,c)
    Number.prototype.define("base", function(b, c) {
      var s = "", n = this
      if (b > (c = (c || "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").split("")).length || b < 2) {
        return ""
      while (n) {
        s = c[n % b] + s, n = Math.floor(n / b)
      return s
    ...