Eug*_*ash 8 javascript duplicates
可能重复:
有人可以解释这个Javascript方法吗?
(x = [].reverse)() === window // true
Run Code Online (Sandbox Code Playgroud)
知道为什么吗?
(x=[].reverse)() === window // true
一开始不明白这个,但我想这很简单:首先 x 成为数组的逆函数,然后用
this === window。所以相当于window.reverse(). 刚刚查了一下,reverse() 可以正常工作,所以window.reverse() === window- 尽管它可能与以前有所不同。
我从这个链接得到了这个答案
http://news.ycombinator.com/item?id=1122004
| 归档时间: |
|
| 查看次数: |
203 次 |
| 最近记录: |