Eva*_*oll 8 google-chrome v8 chromium node.js console.log
当我分配console.log
给node.js中的变量时它工作正常,
var l = console.log
l(1) # outputs 1
Run Code Online (Sandbox Code Playgroud)
但是,如果我在Chromium 30的开发工具中做同样的事情,
var l = console.log
l(1) # TypeError: Illegal invocation
Run Code Online (Sandbox Code Playgroud)
怎么会在Chromium的开发工具中不起作用?我为什么要这样,
TypeError:非法调用
究竟为什么这个要求十分到位,我不知道,但我想Chrome的console.log
需要的值this
是console
.如果要将其存储在变量中,则必须绑定以下值this
:
var l = console.log.bind(console);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1248 次 |
最近记录: |