Update:
The following code works fine until $ char.to_text encounters an integer greater than 55 834 574 847.
alpha="abcdefghijklmnopqrstuvwxyz"; $char={ to_num:function(s,c){ var l=c.length,o={}; c.split('').forEach(function(a,i){ o[a]=i }); return s.split('').reduce(function(r,a){ return r*l+o[a] },0) }, to_text:function(i,c){ var l=c.length,s=''; do{ s=c[i%l]+s;
Here is a quick snapshot:
$char.to_num("military",alpha) => 98987733674 $char.to_text(98987733674,alpha) => "undefinedundefinedundefinedundefinedundefinedundefinedundefinedy"
In manually repeating the above code, it should generate a normal answer, why does it return this string "undefined ...", simply because it is a large number operation for JS?
source share