TypeError: Illegal invocation

2018-3-14 22:52:45 5,170 views
var args = Array.prototype.slice.call(arguments);
           console.log.apply(null, args);
发现报错:
TypeError: Illegal invocation
This is expected because console.info expects its "this" reference to be console, not window.
原因就是console的this对象不能更換,把上面的null改为console就可以了。

11

分享到微信朋友圈

打开微信,点击底部的“发现”,
使用“扫一扫”即可将网页分享至朋友圈。