Ryan has been working with web technologies since 2004 and is a lover all all things design, especially jQuery and HTML. Big fan of open source. Preferred Languages - Javascript/Java, Preferred Framework-jQuery, Preferred Design Tools - GIMP/Inkscape. Ryan has posted 40 posts at DZone. You can read more from them at their website. View Full User Profile

How to Clear the JavaScript Console in Google Chrome or Firebug Programmatically

04.14.2012
| 1923 views |
  • submit to reddit

If  you are extensively working with the console in the chrome developer tools and the console in Firefox/firebug and you find the need to clear the console many times while you are testing your code, both Chrome and Firefox have a feature that lets you do that programmatically.

Chrome
clear()
Firefox console.clear()
I feel that the Firefox version of the command makes more sense. I have absolutely no idea why the Chrome guys chose to do it differently.
If you are a mouse person, in chrome, you can use the context menu and select Clear Console. If you are using firefox instead, you can use the clear button on top of the firebug console. But I guess you know that already.
Published at DZone with permission of its author, Ryan Sukale. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)