.map()
期望函数作为参数。这有效:
[[1]].map(function(array) {
return Array.prototype.slice.call(array);
});
typeof Array.prototype.slice.call
返回"function"
。
那么为什么以下呼叫无效?
[[1]].map(Array.prototype.slice.call);
它会抛出错误:
Uncaught TypeError: [[1]].map is not a function
at Array.map (native)
at <anonymous>:2:7
at Object.InjectedScript._evaluateOn (<anonymous>:895:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)
at Object.InjectedScript.evaluate (<anonymous>:694:21)