Does the Firebug console console reduce the number of rows in an array?

I have a custom logging function to log into the firebug console, which looks like this:

// the name here is just for fun function ninjaConsoleLog() { var slicer = Array.prototype.slice; var args = slicer.call(arguments); console.log(args); } 

And it works exactly the same as I want .... in addition, if I have string values ​​longer than 7 words in the array, the firebug console hides the string value, with the exception of the first two words and the last two words, (Approx. )

Example:

 ninjaConsoleLog("This is a longish string, like the energizer bunny, it just keeps going and going and going."); 

The above function call leads to the following output to the firebug console:

 ["This is a longish strin...going and going."] 

This would be good, except that sometimes the part of the line that the console abbreviation contains contains important data.

First, why is this happening?

Secondly, with my current logging function, is there anyway that I can make the console print a full string value for each element of the array? Or just browse the entire line while viewing console output?

Or is it impossible?

Thanks!!

+2
source share
2 answers

Try changing it to console.dir (args) instead of console.log (args)

You should also be able to click values ​​in the firebug console to expand them to their full values. The field symbol will either be a plus, or when you click on a value, it will become underlined, which means that clicking on it will expand to the full value

+8
source

If you want to view the entire row (s) without expanding individual elements of the array (dir () will display collapsed results), you can call toString() in the array, and Firebug will show you the entire array as a string, for example:

 var arr = [ "This is a longish string, like the energizer bunny, it just keeps going and going and going.", "Another longish string Another longish string Another longish string Another longish string.", "A third longish string A third longish string A third longish string A third longish string." ]; console.log(arr.toString()); 

... which leads to this line:

This is a longish string, like the energizer bunny, it just keeps going and going and going.,Another longish string Another longish string Another longish string Another longish string.,A third longish string A third longish string A third longish string A third longish string.

+1
source

All Articles