What are JavaScript's builtin strings?

前端 未结 7 557
情歌与酒
情歌与酒 2020-11-28 00:52

this question is difficult to summarize in a question title

UPDATE I created a JSFiddle that builds an obfuscated string out of your input

7条回答
  •  孤城傲影
    2020-11-28 01:19

    For the general use-case, if character casing isn't a big concern, I might be inclined to cheat a little.

    Create function "c" which turns a number 0 .. 25 into a character.

    c=function(v){for(var i in window){for(var ci in i){if(parseInt(i[ci],(10+11+11)+(1<<1)+(1<<1))==(v+10)){return i[ci]}}}};
    

    For performance reasons, pre-cache the letters, if you want.

    l=[];for(var i=0; i<(11+11)+(1<<1)+(1<<1);i++){l[i]=c(i);}
    

    In the Chrome console, the resulting array looks like this:

    > l;
    ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "K", "l", "m", "n", "o", "p", "q", "r", "S", "t", "u", "v", "w", "x", "y", "Z"]
    

    So ... your v might be l[10+10+1].

    Alternatively, a general solution like this:

    p=(function(){10%11}+[])[1+11+(1<<1)]; // "%"
    u=(function(){club=1}+[])[1+11+(1<<1)]; // "u"
    vc=p+u+(0+[])+(0+[])+((111>>1)+11+10+[]); // "%u0076"
    unescape(vc);
    

    Or, for this specific problem, maybe just:

    (function(){v=1}+[])[10+(1<<1)]; // "v"
    

提交回复
热议问题