Check out this fiddle for reference: http://jsfiddle.net/calvintennant/jBh3A/
I am interested in utilizing console.log
as an event listener:
badButton.addEventListener('click', console.log);
However, the fiddle demonstrates that this approach will trigger an error.
I am aware of the workaround to resolve the error (by enclosing console.log
in another function). My query is regarding the reason behind this error. Could there be a security measure preventing the usage of native functions in this manner?