JavaScript console debug() Method

JavaScript console.debug() method is used to output a message to the web console at the ‘debug’ log level. The message will only be displayed in the console if the console’s current log level is set to “debug” or a higher level of verbosity.


console.debug(obj, msg)


  1. obj: It is a list of JavaScript objects to output.
  2. msg: It is a JavaScript string containing zero or more substitution strings.

Return value


Example 1: Usage of console.debug()

  let obj = { name: "Maeve Willy" }
  console.debug(obj, "You have reached here!")


How to Use console.debug() Method

Example 2: Debugging

  console.debug("Debugging information");

  let x = 5;
  let y = 10;
  console.debug('The values of x and y are: ', x, y);

  function calculateSum(a, b) {
    console.debug('calculateSum is called with arguments: ', a, b);
    return a + b;

  let sum = calculateSum(x, y);
  console.debug('The sum is: ', sum);


JavaScript debugging example

By default, console.debug() outputs might not show up in your browser’s console. You must ensure the console’s log level includes “debug” messages. The method to do this varies by browser and by console.

Browser compatibility

The console.debug() Method is supported by all browsers.