Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debugging javascript in Chrome console

I inserted quite a few console.log(); statements in a javascript program (written by someone else) and went to view the results in Chrome console. You'll see from the image in this post that three of the lines have numbers inside of them (32, 8, and 8). Those numbers are not clickable. The console is only showing a few of the console.log statements, so I'm guessing those numbers are referring in some way to the other statements not displayed. This is the first time that I've seen that happen, although I've done this same thing before (inserted a lot of console.log statements).

1) does the fact that it's not showing all the console log statements mean something significant? 2) is there some way to understand what those numbers mean, and why they're shown?

enter image description here

like image 611
BrainLikeADullPencil Avatar asked Dec 15 '22 19:12

BrainLikeADullPencil


1 Answers

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

For example, if you have the following loop:

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

Chrome's console will show a single line with (100) a, whilst others, such as Internet Explorer's Developer Tools, will print a a hundred times.

like image 136
João Silva Avatar answered Dec 18 '22 11:12

João Silva