问题
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