[英]javascript syntax reader is wrong?
i have this code , don't get me wrong it all work fine 我有这个代码,不要误解我一切正常
var w = "window" ,
gg = "gg" ,
pr = "prototype" ,
al = "alert" ,
pi = "parseInt" ,
st = String ,
ts = "toString";
st[pr][gg] = function(){return window[this[ts]()];};
w = w[gg]();
w[al](w[pi]("0"));
the problem starts when i replace this piece of code 当我替换这段代码时,问题就开始了
w = w[gg]();
w[al](w[pi]("0"));
with this one 用这个
w[gg]()[al](w[pi]("0"));
now it's not working. 现在它不起作用。
i don't get it , it suppose to get the same result , what is wrong here? 我不明白,它假设得到相同的结果,这里有什么问题?
There are two places that w
is used: 使用
w
有两个地方:
w[al](w[pi]("0"));
^ ^
So you need to substitute in w[gg]()
twice : 所以你需要在
w[gg]()
替换两次 :
w[gg]()[al](w[gg]()[pi]("0"));
^^^^^^^ ^^^^^^^
Note also that this transformation might still not equivalent, for example if w[gg]()
has side-effects or is non-deterministic. 另请注意,此转换可能仍然不等效,例如,如果
w[gg]()
具有副作用或是非确定性的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.