编程语言
首页 > 编程语言> > javascript-这种脱节的目的是什么?

javascript-这种脱节的目的是什么?

作者:互联网

下面的代码来自google analitycs api.我可以想象一些目的是为了加密脚本,而有些目的是为了减小文件大小.但我想还有更多这些.除了这些之外,这种清白的目的是什么?

var g = void 0, 
i = !0, 
j = null, 
k = !1, 
aa = encodeURIComponent, 
ba = Infinity, 
fa = setTimeout, 
ga = decodeURIComponent, 
l = Math;
function ha(a,b){
    return a.name=b
    }

var 
m = "push",
ia = "test",
ja = "slice",
o = "replace",
ka = "load", 
la = "floor",
ma = "charAt",
na = "value",
q = "indexOf",
oa = "match",
pa = "port",
qa = "createElement",
ra = "path",
r = "name",
t = "host",
u = "toString",
v = "length",
w = "prototype",
sa = "clientWidth",
x = "split",
ta = "stopPropagation",
ua = "scope",
y = "location",
va = "search",
z = "protocol",
wa = "clientHeight",
xa = "href",
A = "substring",
ya = "apply",
za = "navigator",
B = "join",
C = "toLowerCase",
D;

解决方法:

这些变量可用于动态创建javascript变量名称.
再加上选择的变量类型(仅一个或两个字母)将缩短代码.

更新:示例:

var 
  m = "push",
  ia = "test";

for(i=0;i<100;i++)
  eval("var " + ia + i " = \"my_value\";");

标签:performance,javascript,reverse-engineering
来源: https://codeday.me/bug/20191101/1981029.html