DOM Console

The Browser Console can read the JavaScript, run your code and then show the result. Console is part of many developer tools included in your browser like Google Chrome, FireFox, Internet Explorer or Safari.

How to access Console:

To access the browser’s console use any one of the following methods:

  1. In Google Chrome, right click anywhere in empty space and select option ‘inspect’ then click on console tab. Alternatively, press Command+Option+J on Mac or Control+Shift+J on Windows, Linux, Chrome OS) to open the Console.
  2. In Firefox, right click anywhere in empty space and select option ‘inspect element’ then click on console tab.
  3. In Internet Explorer, right click anywhere in empty space and select option ‘inspect element’ then click on console tab.
  4. In Safari, choose Safari > Preferences, click Advanced, then select “Show Develop menu in menu bar”.

Console in JavaScript

The Console object in JavaScript provides access to the browser’s debugging console. You can write and test yourJavaScript code in browser’s console. Here are some of the methods of console in JavaScript.

  1. console.log() is a method that write to the console without using alert
  2. console.info() writes message to the console.
  3. console.error() shows error message.
  4. console.debug() shows debug messages.
  5. console.warn() shows warning messages.