For example, bug() is not color-coded and () has an additional icon next to it. Here is the same list in Firefox and, while it looks similar, there are three minor differences.
Firefox console showing debug, error, info, log, and warn The error and warn outputs have an additional icon for even easier identification. Notice that some of them have a color treatment to give a visual indication of the type of output it is. This is an example in Chrome of each command outputting a string, such as bug('bug()'). Chrome console showing debug, error, info, log, and warn Before we get into what you can log in these five commands, let’s see our first minor difference between Chrome and Firefox. I’m sure many of you have seen console.log() before (I mean, we just talked about it up top) and have probably used it before. But browsers provide additional features tied to the five commands to give each their own distinct benefit. There are five commands that at first glance seem to do the exact same thing. This will clear the console and will helpfully inform you of that by outputting a message like “Console was cleared.” Common usage: debug(), error(), info(), log(), and warn() However, the console object itself also provides a command to handle this: console.clear() Browsers typically provide a button in DevTools that performs this task. Sometimes you just want to clear things out and start with a fresh console.
With heavy usage of the console comes a very crowded output of text.
#Chernobylite console commands code
That way, you can be fairly confident that your code will output much the same regardless of the browser in use. Thankfully, most of the differences between the browsers tend to be just as trivial. Firefox doesn’t provide this property and yet has a “name” property that Chrome does not have. One such difference I can point out between Firefox and Chrome is that Chrome provides a “memory” property that outputs some basic memory usage stats. If there are differences in the properties of the console object from one browser to another, this way you can see the differences. Most of them are functions and will be rather consistent regardless of browser. This command will output the various properties of the console object as the browser knows them. The first thing we can do is log the console object itself to see what your browser of choice actually offers. The new Chromium-based Edge is essentially the same as Chrome in many ways so, in most cases, the console commands will operate much the same. This guide covers what’s available in the console object of Firefox and Chrome as they are often the most popular browsers for development and they do have a few differences in various aspects of the console. Some of these differences are simply visual in nature while others do have slight functional differences to keep in mind.įor the curious, here’s the spec by WHATWG linked from the MDN console docs. Even though these features are mostly consistent between browsers, there are a few differences. These commands are contained in a console object available in almost every browser. There is also a way for a website’s JavaScript to trigger various commands that output to the console for debugging purposes. Starting out as a means for errors to be reported to the developer, its capabilities have increased in many ways such as automatically logging information like network requests, network responses, security errors or warnings. The developer’s debugging console has been available in one form or another in web browsers for many years.