console.log freeze javascript console console.log freeze javascript console google-chrome google-chrome

console.log freeze javascript console


Yes, I would avoid spamming the console. In my experience you can log a surprisingly large amount of data, for instance an array with tens of thousands of items, but you can't call the log function too often or the development tools will freeze while it's redrawing.

So with the above in mind, I would suggest grouping several of your log calls together in an object or array. For instance, if you have a loop that will run a LOT of times and you have 5-6 log calls inside, group those log calls together by adding the data to an array or an object with well names keys, and log that object at the end of the loop.

If you have to log more than once per 100ms for more than a few seconds, I would suggest grouping the log calls.


I would suggest is that when debugging, run something else that does not spam the console with 60 items per second. The same problem happens when you try to run this code:for (var i = 0; i < 99999;/*This will spam the console*/ i++) {console.log(i);}Spamming the console 60 times a second has the same effect, freezes the screen. Try having a second variable that prints in the console once every second, or even twice, so you can narrow it down and fix your bugs. This is probably the safest way there is if you do not want to crash your console.

I hope this helped! :)