如果你在Chrome控制台中运行以下代码:
console.log.apply(null, [array])
Chrome 给您返回了一个错误:
// TypeError: Illegal Invocation
为什么?(在OSX上通过Chrome 15进行测试)
如果你在Chrome控制台中运行以下代码:
console.log.apply(null, [array])
Chrome 给您返回了一个错误:
// TypeError: Illegal Invocation
为什么?(在OSX上通过Chrome 15进行测试)
当执行上下文从控制台更改为任何其他对象时,它可能无法正常工作:
This is expected because console.info expects its "this" reference to be console, not window.
console.info("stuff") stuff undefined console.info.call(this, "stuff") TypeError: Illegal invocation console.info.call(console, "stuff") stuff undefined
This behavior is expected.
console.info.call(console, "stuff")
。 - mucahoconsole.info.apply(console, arguments)
。 - PeterM