Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what could it be the purpose of this kind of decleration?

The below code is from google analitycs api. I can imagine some of the purpose is for encrypting the script and some is for lowering the file size. But i thing there is more of these. What could it be the purpose of this kind of decleration but these?

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;
like image 992
Lupus Avatar asked Dec 31 '25 19:12

Lupus


1 Answers

Those variables can be used to dynamically create javascript variable names. Plus the kind of varaibles choosen (one or two letters only) will shorten the code.

Update: Example:

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

for(i=0;i<100;i++)
  eval("var " + ia + i " = \"my_value\";");
like image 140
Thariama Avatar answered Jan 03 '26 09:01

Thariama



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!