In JavaScript, you can set variables to hold certain functions and use them, like so:
var log = console.log;
log('foo');
But for some strange reason, you can't do that on most if not all document methods, such as querySelector
:
var select = document.querySelector;
// causes the error: Uncaught TypeError: Illegal invocation
select('p');
<p>...</p>
Why is that, and is there a workaround for it?