日期:2014-05-16  浏览次数:20325 次

【淘宝ued一道智力题】求解释

a="hostname,test,value,input,getElementsByTagName,nextQuiz,23805,http,protocol,location,reverse,join,split,w2YPYLRVr6x5OOflZjuAvWnZLGa?/ziuq/moc.oaboat.deu//:ptth,GET,...".split(",");this[a[5]]=a[13][a[12]]("")[a[10]]()[a[11]]("");


上面代码在firebug的控制台输出是上面url的反序,原理是什么呢。js可以用jquery 的串联写法吗
淘宝 javascript 趣味题

------解决方案--------------------
实际执行的是
'w2YPYLRVr6x5OOflZjuAvWnZLGa?/ziuq/moc.oaboat.deu//:ptth'['split']("")['reverse']()['join']("")
第一次见到这种写法
正常的是
'w2YPYLRVr6x5OOflZjuAvWnZLGa?/ziuq/moc.oaboat.deu//:ptth'.split("").reverse().join("")


想想也对
访问对象的成员,既可以是 obj.name,也可以是 obj['name']