admin管理员组文章数量:1434958
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?
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?
Share Improve this question asked Sep 24, 2012 at 0:02 BrainLikeADullPencilBrainLikeADullPencil 11.7k24 gold badges82 silver badges138 bronze badges 3- 3 it's saying that the same thing is bieng logged 32, 8 and 8 times – jeremy Commented Sep 24, 2012 at 0:03
- strange because in firebug it's showing a full list of console.log statements. – BrainLikeADullPencil Commented Sep 24, 2012 at 0:06
-
2
This is a feature, not a bug. It was done by design because it's far easier to see that a single
console.log
statement was made 87 times by looking at the number to the left while in Firefox, you'd have to try and count. – TMan Commented Sep 24, 2012 at 0:08
2 Answers
Reset to default 9Nothing 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.
Those are repeat occurrences of the same thing being logged, on the same line of code, in quick succession. So you logged it 32 times, then a little later you logged it 8 more times, then 8 more times again.
本文标签: debugging javascript in Chrome consoleStack Overflow
版权声明:本文标题:debugging javascript in Chrome console - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745621303a2666697.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论