level 6
谁帮解释一下这段js的计算过程?
Array.prototype.each = function(closure) {
return this.length
?
[closure(this.slice(0, 1))].concat(this.slice(1).each(closure))
:
[]
;
}
alert([1,2,3,4].each(function(x){return x * 2}));
//注意,把全角空格“ ”替换为 半角“ ”。
2011年09月20日 09点09分
1