Bound console methods

大城市里の小女人 提交于 2019-12-22 06:40:58

问题


To my knowledge, console methods are bound in most if not all modern JS engines.

var log = console.log;
log('foo');

window.addEventListener('load', console.log); // or any other API that accepts callbacks

will result in proper console output, at least in up-to-date Edge, Firefox and Chrome/Node.js versions, so it's relatively safe to rely on this behaviour in development environment.

Unfortunately, Can I use and MDN don't cover this and potentially contain unverified information.

What are exact browser versions where this behaviour is supported?

Is this a part of any current standard or a proposal?

来源:https://stackoverflow.com/questions/50660346/bound-console-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!