Debug javascript in Chrome console

I inserted quite a few console.log (); in a javascript program (written by someone else) and looked at the results in the Chrome console. You will see from the image in this message that the three lines have numbers inside them (32, 8, and 8). These numbers are not available for viewing. The console will only show a few console.log commands, so I assume that these numbers somehow refer to other non-displayed operators. This is the first time I have seen this, although I did the same thing before (I inserted a lot of console commands).

1) Does the fact that it does not show all console log statements mean something important? 2) is there any way to understand what these numbers mean and why are they shown?

enter image description here

+4
source share
2 answers

Nothing substantial. It's just that the Google Chrome console is smart enough to group identical lines and update a counter indicating how many repetitions there were, instead of printing each identical magazine in a new line.

For example, if you have the following loop:

for (var i = 0; i < 100; i++) { console.log("a"); }​ 

The Chrome console will display one line with (100) a , while others, such as Internet Explorer development tools, will print a hundred times.

+9
source

These are repeated occurrences of the same thing, which are written in one line of code in quick succession. Thus, you registered it 32 times, then a little later you registered it another 8 times, then another 8 times.

+3
source

Source: https://habr.com/ru/post/1435814/


All Articles