what does console.log.bind(console) do?

Function#bind allows you to create a new function, whose this value will be set to the value you pass.


Hence, it allows you to abstract the console.log statements. So, you can type :

var log = console.log.bind(console, '[Init]');

log('Audio Connect'); // [Init] Audio Connect


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *