JavaScript: console.log error

When working in JavaScript I have done output with console.log, but after that my page was working correctly only in debug mode.

I have found the solution in the page What is console.log and how do I use it?: the reason is that in Internet Explorer up to version 8, console.log is defined only in debug mode.

The solution is to add in your page the following JavaScript code:

   if(!window.console){ window.console = {log: function(){} }; }

Add comment

Loading