Fixing the error “TypeError: ‘undefined’ is not a function (evaluating ‘globalScope[‘console’][‘log’].bind(globalScope[‘console’])’)”

Some libraries, like PDF.js, initialize their own logging function, which wraps console.log1. If this runs in a context where function.bind does not exist, you’ll get the following error: TypeError: ‘undefined’ is not a function (evaluating ‘globalScope[‘console’][‘log’]. bind(globalScope[‘console’])’) Fixing this is actually quite simple- Mozilla provides a replacement function2 you can drop-in (not surprising, considering how …